BookmarkSubscribeRSS Feed
eee100
Calcite | Level 5

Please help my macro code has errors and I cannot figure it out. this is very time sensitive! Here is the question I am asked: Use a single macro with two parameters to assess the correlation between mean fasting glucose and age, body composition, blood pressure and lipid concentrations a. Obtain unadjusted correlations between mean fasting plasma glucose and age, weight, weight at age of 20, percent weight change, waist to hip ratio, BMI, HDL cholesterol, total cholesterol, the ratio of total to HDL cholesterol (as a continuous variable), systolic blood pressure and diastolic blood pressure. b. Obtain age-adjusted correlation coefficients for the above-mentioned correlation tests (except for the correlation between mean fasting plasma glucose and age)

 

 

 

Here is my code: %macro mycorr(&a=, &b=); proc corr data=PJ123 spearman; var meanFG; with &a; only &b; run; %mend mycorr; %mycorr(a=Age weight20 WTPCT WHR BMI HDL CHOL TCHDL SBP DBP); %mycorr(a=weight20 WTPCT WHR BMI HDL CHOL TCHDL SBP DBP, b=age);

1 REPLY 1
WarrenKuhfeld
Ammonite | Level 13

Remove the ampersands from this line:

%macro mycorr(&a=, &b=); 

 

I have never heard of an ONLY statement in PROC CORR.  

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 373 views
  • 0 likes
  • 2 in conversation