Hi, on page 162 of the specialist prep guide, it states that ID statement will concatenate variables specified in that statement and indeed the print out shown in the book is concatenated.
However I am unable to reproduced it with the same code, the variables are separated by a comma and space/line break. Why is there a difference in the output?
proc transpose data=cert.cltrials out=transtrials2; var cholesterol triglyc uric; id name testdate; run; proc print data=transtrials2; run;
The commas and additional letters are in your data in the name variable.
See this for an example:
data trials;
input name $ date :date9. value;
format date date9.;
datalines;
John,A 01jan1960 1
Richard 02jan1960 2
;
options validvarname=any;
proc transpose data=trials out=trials1;
var value;
id name date;
run;
proc print data=trials1;
run;
options validvarname=v7;
proc transpose data=trials out=trials2;
var value;
id name date;
run;
proc print data=trials2;
run;
The second run with validvarname=v7 is just there to show the effect of the option.
There may be a difference between the data used when the prep guide was set up and the data as it is now.
Interesting. I don't have access to the data used, but when i run
proc transpose data=sashelp.class out=work.transposed;
var Weight Height;
id Name Age;
run;
the result is as expected, not comma between the values.
The commas and additional letters are in your data in the name variable.
See this for an example:
data trials;
input name $ date :date9. value;
format date date9.;
datalines;
John,A 01jan1960 1
Richard 02jan1960 2
;
options validvarname=any;
proc transpose data=trials out=trials1;
var value;
id name date;
run;
proc print data=trials1;
run;
options validvarname=v7;
proc transpose data=trials out=trials2;
var value;
id name date;
run;
proc print data=trials2;
run;
The second run with validvarname=v7 is just there to show the effect of the option.
There may be a difference between the data used when the prep guide was set up and the data as it is now.
Thanks Kurt.
You are correct, this solved the mystery. The data provided is not matching as I mentioned in the prep guide errata thread and it is causing all these confusion.
Who is the editor/proof reader at SAS for these prep guides man? I swear I can do a better job.
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.