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

Hello,

new day and I have new SAS beginners problem. I want to calculate the variance for two parameters in my data set and in the next step I want to do some calculations with the just calculated variances. For that I tried to write a macro because I want to apply that method on some more data sets:

%MACRO calculateICC(data, name);
   PROC UNIVARIATE DATA = &data;
   VAR a;
   VAR e;
   OUTPUT out = var VAR=vara VAR=vare;
   data ic&name;
   set var;
   ic = vara/(vara + vare);
   output out = ic;
   run;
%MEND;

I think the first part is wokring alright. But the second part is messed up.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

The DATA step does not have an OUTPUT statement. Delete that statement, as indicated below

data ic&name;
   set var;
   ic = vara/(vara + vare);
/*   output out = ic; DELETE */
   run;

 

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

@mrer wrote:

Hello,

new day and I have new SAS beginners problem. I want to calculate the variance for two parameters in my data set and in the next step I want to do some calculations with the just calculated variances. For that I tried to write a macro because I want to apply that method on some more data sets:

%MACRO calculateICC(data, name);
   PROC UNIVARIATE DATA = &data;
   VAR a;
   VAR e;
   OUTPUT out = var VAR=vara VAR=vare;
   data ic&name;
   set var;
   ic = vara/(vara + vare);
   output out = ic;
   run;
%MEND;

I think the first part is wokring alright. But the second part is messed up.


We have no idea what you mean by "first part". We have no idea what you mean by "second part". We have no idea what "messed up" means.

 

Please be extremely specific.

 

Please show us sample data.

 

Please show us the SASLOG or output data set and explain clearly and in detail what is "messed up".

--
Paige Miller
Rick_SAS
SAS Super FREQ

The DATA step does not have an OUTPUT statement. Delete that statement, as indicated below

data ic&name;
   set var;
   ic = vara/(vara + vare);
/*   output out = ic; DELETE */
   run;

 

mrer
Fluorite | Level 6

Thanks! It is working now.

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!

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
  • 3 replies
  • 2315 views
  • 2 likes
  • 3 in conversation