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.
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.