Hi there,
I have a variable "studytype" and further variables var1, var2, var3. Now I want to create an Excel file, that lists all data with var1-var3, grouped by studytype.
Before a new studytype starts, I want to add a Headline mentioning the studytype.
For example:
studytype var1 var2 var3
A 1 abcd 1111
A 1 werewre 234234
B 1 jwlkerjwerkl 3423432
Should appear like:
A
1 abcd 111
1 werewere 234324
B
1 jwlkerjwerkl 3423432
My code:
Ods tagsets.ExcelXP path=&path. file='out.xml' style=seaside;
proc report data=mydata nowd;
column studytype var1 var2 var3;
define studytype/ order noprint;
break before studytype / skip;
compute before studytype;
line'';
endcomp;
run;
ods tagsets.ExcelXP close;
It´s quite close to what I need, but how can I get the studytype (current value of studytype for this break) in the Headlines created by the "line" statement?
Thanks a lot for your Input.
Well, posting test data in the form of a datastep would be helpful as I am not typing that in. Two things jump to minds, though I can't test:
options byline;
Per: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000234737.htm
This should print each by group.
What about adding:
compute before studytype;
line'';
line studytype;
endcomp;
Otherwise as above, post some test data in a usable format.
Sorry about the missing data - will keep that in mind for the next time 🙂
"line studytpe" was the solution... So simple! It shows values instead of value labels, but I am pretty sure that I will find a solution for that on my own.
Thanks so much!
If its a format then maybe (again not tested):
compute before studytype;
line'';
line studytype myfmt.;
/* Or for character */
line studytpe $myfmt.;
endcomp;
Obviously replace the myfmt with the actual name of your format.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.