When I do this step i am not getting a and b merged instead the info available in other dataset also appears . Likewise with c and d and e and f also..........!!!!Can somebody help me?
Thanks
data LOS_final_1 MORT_final_1 READMITS_final_1;
mergeLOS_ranks(in=a) LOS_Percentiles(in=b)
MORT_ranks(in=c) MORT_Percentiles(in=d)
READMITS_ranks(in=e) READMITS_Percentiles(in=f);
byDischarge_Quarter;
if a and b then output LOS_final_1;
if c and d then output MORT_final_1;
if e and f then output READMITS_final_1;
run;
You will need to add either a KEEP= or DROP= option to the output data sets to get the variables you want. The choice would depend on which creates a longer list. It might look something like this
data LOS_final_1 ( keep = Discharge_Quarter var1 var2)
MORT_final_1 ( drop = var5-var15)
READMITS_final_1 (keep = list of variable names you want);
The variablke names are different for each of these datasets except for only 2 variable names which are common to all the rank datasets.
the variable names for the percentiles dataset are different.
BASICALLY I DINT WANT TO DO THIS STEP:
data
LOS_final_1;
merge LOS_ranks(in=a) LOS_Percentiles(in=b);
by Discharge_Quarter;
run;
data MORT_final_1;
merge MORT_ranks(in=a) MORT_Percentiles(in=b);
by
Discharge_Quarter;
run;
data READMITS_final_1;
merge READMITS_ranks(in=a) READMITS_Percentiles(in=b);
by Discharge_Quarter;
run;
Then you need to rename your variables because if you merge with the same variable names they will overwrite each other.
Why would you not use 3 DATA steps, each with its own MERGE? That program does exactly what you need. What is the reason for trying to switch?
Thats a good question. That works perfectly fine. But since i am a beginner in using sas programming i am trying to learn all the possible ways.
Then this illustrates a good lesson. While there are often many ways to achieve an acceptable solution in SAS, pick the right tool for the job. If you do, your program will usually be short and simple. If you pick the wrong tool for the job, your program will become complex and more difficult to work with. Occasionally, a programming objective requires complexity. (Unfortunately, if you hang out here you see a non-representative sample of more complex problems, not the simple ones.) As a general rule, if your program is become complex, think about whether there is another way to get what you want.
Good luck.
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!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.