BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
yp2609
Fluorite | Level 6

 

yp2609_0-1685480023353.png

yp2609_1-1685480039371.png

 

I want to export/save results from SAS report to a SAS dataset to further manipulate it. Please help!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Please post your code as text, pain to type it out and make sure the variables are correct, so generic code is below. 

In general, just use proc means and a proc transpose to get what you need. 

 

proc means data=have noprint nway;
class var1 var2 var3;
var amount;
output out=summary sum=;
run;

proc transpose data=summary;
by var1 var2;
id var3;
var amount;
run;

View solution in original post

6 REPLIES 6
Reeza
Super User

proc tabulate has an OUT= option that will pipe the data/calculations to a data set. It will not be in the format shown though.

 

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n1hpbwr9acrbmen1e2d6hxjkotm1.htm#p08ap61...

 


@yp2609 wrote:

 

yp2609_0-1685480023353.png

yp2609_1-1685480039371.png

 

I want to export/save results from SAS report to a SAS dataset to further manipulate it. Please help!

 

 


 

yp2609
Fluorite | Level 6

Reeza, thank you! I know there is OUT= option, but I really want to keep the same formatting here. Anyway, I will try to figure a way out. 

Reeza
Super User
You can use transpose with the _TYPE_ and other automatic variables to reformat the data. Your data is not complicated so you can do this fairly easily.
Reeza
Super User

Please post your code as text, pain to type it out and make sure the variables are correct, so generic code is below. 

In general, just use proc means and a proc transpose to get what you need. 

 

proc means data=have noprint nway;
class var1 var2 var3;
var amount;
output out=summary sum=;
run;

proc transpose data=summary;
by var1 var2;
id var3;
var amount;
run;

yp2609
Fluorite | Level 6
I'll give it a try. Thank you!
ballardw
Super User

Can you provide an example of the sort of manipulation you may want?

 

The limits of a SAS data set means that the layout appearance can't be stored. SAS data set variables hold a value. Columns of a report, depending on the syntax of a table, can contain the statistics from multiple variables. Which doesn't go well with the tabular view of a data set.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 6 replies
  • 691 views
  • 3 likes
  • 3 in conversation