When I try to merge two datasets by using "proc sql", I always meet this issue. This is my code:
Proc sql;
create table lab.data2 as
slelct a*, b. BMI
from lab.data1 as a
left join lab.data as b
on a. ID=b.ID;
run;
I wonder if is there a compress option for "proc sql". How can I write the code with that option? Additionally, I have already changed sasv9 and set sasuser and work file under D drive.
"lab" folder was saved under Box under C drive. I wonder if it is better to save the new dataset offline rather than online in Box. I think the C disk is full may also be due to Box. Does anyone meet the same situation? How to deal with that?
Open Windows Explorer and check how much free disk space you have on D and C drives. It's not clear from your description which drive you are running out of space on as you will be writing to both. Delete any unwanted files on these drives. Check your D SASWORK folder and delete any old _TDnnnn folders that aren't for your current SAS session. If you have freed up significant space, try rerunning your program.
Have you made sure (by using PROC SORT with NODUPKEY) that ID is unique in at least one of the datasets, or is this a many-to-many join?
How large are the datasets (number of observations, total file size for lab.data1)?
Depending on this information, a sequence of PROC SORTs and a DATA step can do it, and if lab.data is not too large (number of observations) and unique with regard to ID, a single DATA step with a hash object will achieve your join much more efficiently.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.