Hello SAS friends, I am new to SAS and I am still learning. I am in need of a program that generates a random ID. I found a script on this forum and made a few changes and it works, but it is not quite what I need. I need this script to force the random generating ID to Always use at least 1 upper case letter, 1 number and 1 special character (# or @). Is this possible? Here is the code I am using. data temp (keep=id_out);
allowed="123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz#@";
num_ids=1;
idlen=8;
array done{100} $200.;
length my_id $6;
num_allowed=length(strip(allowed));
i=1;
do until (i=num_ids+1);
do j=1 to 6;
temp=ceil((num_allowed * rand("uniform")));
substr(my_id,j,1)=substr(allowed,temp,1);
end;
if whichc(my_id,of done{*})=0 then do;
done{i}=my_id;
i=i+1;
id_out=my_id;
output;
end;
end;
run; Any help would be great!
... View more