BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
oyho
Calcite | Level 5

so that summaries from different files can be merged into one file. Procedures with a model statement have a labelling possibility, but what is the 9.4.-trick in proc means?

 

best

oyho

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

How about using BY processing?

 

data all_panels;
set panel0_: indsname=_p;
panel = _p;
run;

proc means data=all_panels;
by panel notsorted;
var...;
output out=all_summary;
run;
PG

View solution in original post

7 REPLIES 7
Astounding
PROC Star

Have you examined the OUTPUT statement within PROC MEANS?

oyho
Calcite | Level 5
Yes, I have.


It is said that label statements can be applied, period, but not how.


I tried:


output out = summary0_&d / label = 'panel&d' ; /* syntax error */


output out = summary0_&d label = 'panel&d'; /* syntax error */


output out = summary0_&d / autolabel ; /* no syntax error, but no label in the file either */


What works of course is the stupid solution: to add the labelling variable in a separate data step (see code below). My post is asking for a more elegant way --- which I presume exists.




%macro panel_stat;

%do d = 0 %to &n_panel;

proc means data = panel0_&d noprint;

var psqt psqt_aav psqt_aav2 aav aav2 t_panel yhat_sum yhat_midl1-yhat_midl&n_prod;

output out = summary0 ;

run;

data summary0_&d;

set summary0;

panel = &d;

run;

%end;


data summary0_&bas_aar;

merge summary0_0-summary0_&n_panel;

by panel;

run;


proc export data = summary0_&bas_aar

OUTFILE = "summary0_&bas_aar"

DBMS = xlsx

REPLACE;

run;


%mend;

%panel_stat;

ballardw
Super User

if you are using a data set option to provide a label for a data set the syntax is

 

datasetname (label="quoted text")

dataset options have to appear within () and all of them within the same outer pair.

datasetname (keep= var1 var2 var3 rename=(var2=something) where=(var1 in (1 2 3)) label="quoted text" )

 

oyho
Calcite | Level 5

Thanks for pointing to the appropriate syntax. Nevertheless, reading the documentation (http://support.sas.com/documentation/cdl/en/ledsoptsref/69751/PDF/default/ledsoptsref.pdf) it seems to me that this is a dead-end. I see no way to enter a 'label' variable into the data set using data set options. That is what I need, and what my stupid data step code provides. Please correct me if I am wrong.

 

Unless you can point to a better solution, I presume that my stupid code is the simplest alternative.

 

best

 

 

 

PGStats
Opal | Level 21

How about using BY processing?

 

data all_panels;
set panel0_: indsname=_p;
panel = _p;
run;

proc means data=all_panels;
by panel notsorted;
var...;
output out=all_summary;
run;
PG
oyho
Calcite | Level 5
Thanks for constructive answer, which I mark as solved. Actually, my case is not solved by this because the panels are overlapping, but I didn't tell you.

oyho
RW9
Diamond | Level 26 RW9
Diamond | Level 26

The trick is to read the manual?  Come back with any specific questions, showing test data/required output, what code you have tried etc.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1566 views
  • 0 likes
  • 5 in conversation