BookmarkSubscribeRSS Feed
meki77
Calcite | Level 5

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.

 

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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. 

meki77
Calcite | Level 5

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!

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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. 

Ksharp
Super User
compute before studytype; line''; line @1 studytype $8. ; endcomp;

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1074 views
  • 3 likes
  • 3 in conversation