BookmarkSubscribeRSS Feed
sahoositaram555
Pyrite | Level 9

I have a list of datasets(in dsets_2 macro list) where I've to perform 1 operation(merge date+time variable) as below. #rawdata. is the library name

%let dsets_2 = %str(rawdata.SERUM_BIO rawdata.CL_HEMA rawdata.CL_PG rawdata.SKIN_BIO rawdata.CL_CHEM rawdata.PHOTO);

 

I've to use this datasets such as SERUM_BIO,CL_HEMA,CL_PG, SKIN_BIO,CL_CHEM,PHOTO through a do loop to form 1 SINGLE DATASET. 

Eg: dsets_2 macro has 6 datasets name, those has to be placed one upon other by SET statement, below code is used to achieve this, but not succeeded, need help to achieve. Kindly guide.  

 

%macro sort(var1=,var2=);
%local ii next_value;
%let ii=1;%let iii=2;

%do %while (%scan(%scan(&dsets_2,&ii, %str( )),2,".)") ~= %str());
%let next_value = %scan(&dsets_2, &ii);
%if &var1 ~=. and &var2 >. %then %do ;
data dset_&next_value.;
set %scan(&dsets_2,&ii, %str( ));
TDATETIME= dhms(LBDAT, 0, 0, LBTIM);format TDATETIME datetime20.;
keep USUBJID &var1. &var2. TDATETIME;
run;
%let ii = %eval(&ii + 1);
%end; %end;

%mend sort;
%sort(var1=LBDAT ,var2=LBTIM);

1 REPLY 1
PaigeMiller
Diamond | Level 26

I think this is very clear:

 

WARNING: Apparent symbolic reference I not resolved.

You can't use a macro variable &i because you haven't given it a value.

 

In the future, please do this:

 

Make this the first line of your program, run it again,

 

options mprint;

and then show us the ENTIRE log for this segment of code, with nothing chopped out, exactly as you see it. Copy the log as text and paste it into the window that appears when you click on the </> icon here. DO NOT SKIP THIS STEP.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 712 views
  • 0 likes
  • 2 in conversation