Hi Everyone,
I have a logistic regression program that I am using that contains a where clause. The where clause is used to to filter between a variable that has seven levels, they are 1, 3, 4, 7, 10, 13, and 14. I'd like to create a macro to go through this variable and run the logistic regression for each level, but I'm unsure as to how to go about it. Below is the logistic regression code with the where clause set to 1:
proc logistic data=have;
class v1(ref="3" param=ref) v2(ref="1" param=ref) v3(ref="3"
param=ref) v4(ref="White" param=ref) v5(ref="0" param=ref)
v6(ref="1" param=ref);
model dv(event="1")=v1 v2 v3 v4 v5 v6
where project = 1;
run;
I've tried doing %let project = (1, 3, 4, 7, 10, 13, 14) and having where project = &project but that gave me an error.
Any resources to help or guide me along would be amazing, thank you so much!
No macros needed. Replace the WHERE statement with a BY statement.
by project;
In data set HAVE, remove any project numbers except 1, 3, 4, 7, 10, 13, 14
No macros needed. Replace the WHERE statement with a BY statement.
by project;
In data set HAVE, remove any project numbers except 1, 3, 4, 7, 10, 13, 14
Make sure the dataset is sorted by PROJECT and then use:
by project;
where project in (1 3 4 7 10 13 14);
Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.
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.
Ready to level-up your skills? Choose your own adventure.