BookmarkSubscribeRSS Feed
supersonic
Calcite | Level 5

I neaad to crate a macro

with input a sas dataset with dependent binary variable ano one predicted probabilty variable.

output a dataset with the stats by deciles- no:of obs, no.of events, %obs, % events, event rate, lift, cumulative lift, avg predicted prbablity.

3 REPLIES 3
supersonic
Calcite | Level 5

any1 help!!

%macro reg(dsname, DV, PV, selecttype );

proc logistic data=&dsname;
     model &DV=&PV
                /selection = &selecttype;

     output out=&out ;
run;

print data=&out;
run;

%mend reg;

is this correct(atleast half part)
%reg()

Tom
Super User Tom
Super User

Looks like you have done it.

The basic process should be:

  1. Figure out what code you want to run. Looks like you want to run PROC LOGISTIC. 
  2. Then identify the parts that you want to vary and turn them into macro variable references and use %LET statements above the code to set the values of the macro variables.
  3. Once you have that working you can then convert the macro variables to parameters in a %MACRO statement.
Linlin
Lapis Lazuli | Level 10

%macro reg(dsname, DV, PV, selecttype );

proc logistic data=&dsname;

     model &DV=&PV

                /selection = &selecttype;

     output out=out_&dsname ;

run;

title from dataset out_&dsname;

print data=out_&dsname;

run;

title;

%mend reg;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 618 views
  • 0 likes
  • 3 in conversation