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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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