Hi All,
I've got a SAS data set like the one below. The second and third rows are the mean and median for the total fee, respectively. Similarly, the last two rows are the mean and median for the unit, respectively. This table is hard to do analysis. I would like to add some indicators to differentiate the two sets of mean and median. Not sure how to do. Thank you in advance.
Variable Value
total_fee
mean 100
median 110
flag_customer 1000
unit
mean 10
median 12
Use RETAIN, please post your sample data using a data step in the future. Instructions on how to provide data in that format is included here.
data have;
infile cards truncover;
informat variable $14.;
input Variable Value ;
cards;
total_fee
mean 100
median 110
flag_customer 1000
unit
mean 10
median 12
;;;;
run;
data clean(where=(not missing(value)));
length variable_Summarized $32.;
set have;
retain Variable_Summarized;
if missing(Value) then Variable_Summarized = variable;
drop variable;
run;
proc print;
run;
@di_niu0 wrote:
Hi All,
I've got a SAS data set like the one below. The second and third rows are the mean and median for the total fee, respectively. Similarly, the last two rows are the mean and median for the unit, respectively. This table is hard to do analysis. I would like to add some indicators to differentiate the two sets of mean and median. Not sure how to do. Thank you in advance.
Variable Value
total_fee
mean 100
median 110
flag_customer 1000
unit
mean 10
median 12
@di_niu0 wrote:
Hi All,
I've got a SAS data set like the one below. The second and third rows are the mean and median for the total fee, respectively. Similarly, the last two rows are the mean and median for the unit, respectively. This table is hard to do analysis. I would like to add some indicators to differentiate the two sets of mean and median. Not sure how to do. Thank you in advance.
Variable Value
total_fee
mean 100
median 110
flag_customer 1000
unit
mean 10
median 12
When you say "This table is hard to do analysis." where does it come from? If you create it as the result of one of the SAS procedures such as Proc means then syntax changes when creating it could make a big difference in how the set is made.
I do agree it would be hard to do analysis but I'm not sure what you actually want as indicators might not be the best way. What types of analysis do you think will be done on this data?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.