SAS MACRO

Reply
Contributor
Posts: 26

SAS MACRO

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- noSmiley Surprisedf obs, no.of events, %obs, % events, event rate, lift, cumulative lift, avg predicted prbablity.

Contributor
Posts: 26

Re: SAS MACRO

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()

Super User
Super User
Posts: 6,495

Re: SAS MACRO

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.
Super Contributor
Posts: 1,636

Re: SAS MACRO

%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;

Ask a Question
Discussion stats
  • 3 replies
  • 293 views
  • 0 likes
  • 3 in conversation