Hi Folks:
I my data is stored by calendar years and I concatenated as shown in the code below. I'm curious if there was more efficient way to concatenate the datasets? I have more than 11 variables to read in actuality and I have to add variables onto all the lists every time I need I decide to add more variables into the analyses.
data c.concatenated(COMPRESS=YES);
set c.data95(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data96(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data97(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data98(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data99(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data00(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data01(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data02(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data03(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data04(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data05(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data06(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data07(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data08(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data09(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data10(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data11(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data12(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data13(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11);
run;
Or even
data c.concatenated(COMPRESS=YES);
set c.data95-c.data99(keep=var1-var11)
c.data00-c.data13(keep=var1 -var11);
run;
HI @Cruise Try this
UNTESTED
data c.concatenated(COMPRESS=YES);
set c.data95-c.data99(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11)
c.data00-c.data13(keep=var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11);
run;
Or even
data c.concatenated(COMPRESS=YES);
set c.data95-c.data99(keep=var1-var11)
c.data00-c.data13(keep=var1 -var11);
run;
Worked like a magic. Thanks much.
data c.concatenated(compress=yes);
set c.data1995-c.data2013 (keep=gender ethnic race age lensty zip dob source1-source6 ....);
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.