Good morning,
I have a problem with the PROC MEANS procedure.
The problem is that I have a table with two variables
-cod (is a code, numeric)
-cod2 (is another code, numeric)
What I want to do is to make a PROC MEANS summarizing by cod and cod2. But PROC MEANS procedure gives me the variables _TYPE_ and _FREQ_ summarizing the variable cod and then the variable cod2 instead of doing together.
My code is:
proc means data=data.table1 noprint;
class cod cod2;
output out=data.table2;
run;
I get the solution it was doing this:
proc summary data=data.table1 print;
by cod cod2;
output out=data.table2;
run;
Thanks for help anyways
Please provide test data in the form of a datastep (or use sashelp.xyz), as this helps us see what you have, and show what you want out. You say you want to summarise cod and cod2, to which statistics? _type_ and _freq_ are SAS derived variables, you can get stats out by (going to assume a few basic ones):
proc means data=data.table1 noprint; var cod cod2; output out=data.table2 / n=n mean=mean median=median stddev=stddev min=min max=max; run;
This will give you a table (assumption as not seen data!) with cod and cod2 on two obs with the given stats as variables. You can read in the manual further examples and full documentation.
I get the solution it was doing this:
proc summary data=data.table1 print;
by cod cod2;
output out=data.table2;
run;
Thanks for help anyways
Several ways:
@CeliaAlonso wrote:
Good morning,
I have a problem with the PROC MEANS procedure.
The problem is that I have a table with two variables
-cod (is a code, numeric)
-cod2 (is another code, numeric)
What I want to do is to make a PROC MEANS summarizing by cod and cod2. But PROC MEANS procedure gives me the variables _TYPE_ and _FREQ_ summarizing the variable cod and then the variable cod2 instead of doing together.
My code is:
proc means data=data.table1 noprint;
class cod cod2;
output out=data.table2;
run;
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.
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.