Recently in the SAS Community Library: SAS' @Sundaresh1 highlights a sometimes overlooked task when applying document embeddings for purposes of similarity-based search. Normalisation of vectors helps obtain relevant matches.
I have a exported an excel report that contains empty cells and would like to write a code that would color all empty cells in the excel output. I have the following code which only highlights/colors empty cells in the NAME column, however I'd like to highlight all empty cells without having to write out code for all 47 columns that I have in my report : PROC REPORT DATA = STAGE1; DEFINE NAME -- REFERRAL_BASIS/ DISPLAY; COMPUTE NAME; IF NAME= '' THEN CALL DEFINE('NAME', "STYLE", "STYLE=[BACKGROUND=CYAN]"); ENDCOMP; RUN;
... View more
Hello, I am getting the following error messages when trying to merge two datasets. One of the datasets I am getting from a csv file, so maybe the issue could be there? I was trying to specify the length of the PID variable for the redcap_sort dataset from the redcap one, which is the one we got from the csv file. However, I keep getting messages that the variable has multiple lengths and it keeps truncating the data. Any PID after 999 gets shortened. So 1000 and 1001 become 100, 1010 becomes 101, etc. Any help or a nudge in the right direction would be greatly appreciated, thank you so much. Edit: The programming with the csv file already has: data work.redcap; %let _EFIERR_ = 0;
infile &csv_file delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=1 ;
informat pid $500. ;
informat pid_ini $500. ; and the code for format: format pid $500. ; It has this for all the variables. I thought the above code would make it so that the variables would have that limit of 500 characters?
... View more
I trying to query company LDAP and extract users from a specific AD Group. I can query/filter on uid, department, etc.... but when trying to pull all users of a specific group, or any group, Suchas with memberof, example filter below, I get no results.
Any suggestions/help?
filter="(&(memberOf=cn=myteam_AD_group,OU=groups,DC=com))";
full code below...
options mprint mlogic ;
%let Attrs= "uid sn givenname groupMembershipSAM, grouppriority groupsToIgnore memberof " ||
"acting comat comatstationid companycode cosspecifier " ||
"costcenter countrycode createtimestamp dc " ||
"delegated departmentaltcontactname departmentcity " ||
"departmentcomailaddress departmentcontactname departmentcostcenter " ||
"departmentcountry departmentdescription departmentdivision departmentkeywords " ||
"departmentlongname departmentname departmentnumber departmentphone departmentpostal " ||
"displayname employeenumber employmentstatuscode employeetype employmenttypecode entrydn " ||
"exemptnonexempt expatintlcomaddr fxdivision fxexecbcdraccess fxjobfamily fxjobfunctioncode " ||
"fxregion fxsoxstatus fxssomemberof givenName icscalendar inetCanonicalDomainName " ||
"inetDomainBaseDN inetDomainStatus inetMailGroupStatus inetUserStatus initials " ||
"jobnumber mail mailAlternateAddress mailEquivalentAddress mailfxaccounttype mailfxhome " ||
"mailHost mailRoutingHosts mailUserStatus managementlevel manager member " ||
"memberOfManagedGroup memberOfPAB memberOfPABGroup modifytimestamp nickname " ||
"nsCalXItemId nscpEntryDN nsds5ReplConflict nsLIProfileName " ||
"nsUniqueId nswcalCALID ntGroupDomainId ntUserDomainId numsubordinates " ||
"ou owner parentid pipstatus pipuid positionnumber postalcode " ||
"postaladdress street isActive isActiveSpecified " ||
"seeAlso sn telephoneNumber tempworklocation title uid un " ||
"uniquemember vendortype workstate xuid"
;
%put &Attrs ;
%put &emp ;
data rpt_output ;
length entryname $200 attrName $100 value $100 filter $100;
rc =0; handle =0;
server="directory.company.com";
port=389;
base="ou=people,o=company,c=us";
bindDN=""; Pw="";
/* open connection to LDAP server */
call ldaps_open(handle, server, port, base, bindDn, Pw, rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else
put "LDAPS_OPEN call successful.";
shandle=0;
num=0;
filter="(&(objectCategory=user)(memberOf=myteam_AD_group,))";
/* filter below works for individual employees */ /*filter="(&(uid=&emp))";*/
/* search the LDAP directory */
call ldaps_search(handle,shandle,filter, attrs, num, rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else do;
put " ";
put "LDAPS_SEARCH call successful.";
put "Num entries returned is " num;
put " ";
end;
do eIndex = 1 to num;
numAttrs=0;
entryname='';
/* retrieve each entry name and number of attributes */
call ldaps_entry(shandle, eIndex, entryname, numAttrs, rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else do;
put " ";
put "LDAPS_ENTRY call successful.";
put "Num attributes returned is " numAttrs;
end;
/* for each attribute, retrieve name and values */
do aIndex = 1 to numAttrs;
attrName='';
numValues=0;
call ldaps_attrName(shandle, eIndex, aIndex, attrName, numValues, rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else do;
put " ";
put "Attribute name is " attrName;
put "Num values returned is " numValues;
end;
do vIndex = 1 to numValues;
call ldaps_attrValue(shandle, eIndex, aIndex, vIndex, value, rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else do;
put "Value : " value;
put "Attribute nbr is " numValues;
Output rpt_output;
end;
end;
end;
end;
/* free search resources */
call ldaps_free(shandle,rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else
put "LDAPS_FREE call successful.";
/* close connection to LDAP server */
call ldaps_close(handle,rc);
if rc ne 0 then do;
msg = sysmsg();
put msg;
end;
else
put "LDAPS_CLOSE call successful.";
run;
quit;
... View more
I've been building an automation program in vbs that uses the SAS EG scheduling vbs as a framework and then I've heavily customised it. Part of that customisation is to run a list of EGP files listed in a set of calls. This all works fine, but my final task is to build a timeout functionality, which I know windows task scheduler has built in, but this is for the entire script. What I am trying to do is build it specific to each time an EGP is called, so that it can kill one if it takes too long and then move on to the rest. What I ended up trying is using the prjobject.isrunning but it doesn't function the way I expected, I can't find any documentation about it and I was hoping someone had used it succesfully in the past. Failing that, has anyone achieved something similar via a different method?
... View more
Hi all, I have successfully created an annotated state map from geocoded address info using the states map. However, when I try to use the county map data set, it appears that the geocoding output does not match what information in the county map dataset. Here is a small program to illustrate the difficulty. Code doesn't get past proc gproject. It seems that the length of x and y of the map do not match the length of x and y in the geocoded output. thanks! Phil : libname lookup "D:\Documents\desi2023\frlanalyses\geocodedata__2006__ZIP4_Geocode_Data\data"; data zips; input c zip; anno_flag=1l cards; 1 65203 2 65211 3 65201 ; proc geocode /* Invoke geocoding procedure */ method=plus4 /* Specify geocoding method */ lookup=lookup.zip4 /* Lookup data from MapsOnline */ data=zips /* Input data set to geocode */ out=geocodedzips; /* Specify name of Output data set of locations */ run; data mocounties;set maps.counties;if state=29; data mocounties;set mocounties geocodedzips;run; proc gproject data=mocounties out=MOCountiesP; id state ; run; data my_map locations; set mocountiesP; if anno_flag=1 then output locations; else output my_map; run; data anno_locations; set locations; if c=1 then color="red"; if c=2 then color="bib"; if c=3 then color="viyg"; if c=4 then color="bippk"; xsys='2'; ysys='2'; hsys='3'; when='a'; function='pie'; rotate=360; size=.5; style='psolid'; output; length html $300; html='title='||quote(trim(left(citystate))||'0d'x||trim(left(put(zip,z5.)))); style='pempty'; color='deb'; output; run; pattern1 v=e; proc gmap data=mymap map=mymap anno=anno_locations; id county; choro segment / coutline=black levels=1 nolegend coutline=gray99;run;
... View more