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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1145 views
  • 3 likes
  • 3 in conversation