I have two pics of macro code, which perform two different task from given parameter. I want to combined these macro in single macro. For testing purpose,I have used class data set from sashelp library. First one:- which will perform EDA according to the variable entered numeric or character %macro eda_analysis(data=,var=,var1=); data analysis_&data; set sashelp.&data; run; proc contents data=work.analysis_&data out=details_&data; run; %if %eval(&type.*1)=1 %then %do; /* variable exploration using proc means*/ proc means data=work.analysis_&data; var &var; title 'Mean analysis'; run; /*proc univariate exploration*/ proc univariate data=work.analysis_&data; /*it gives a detail analysis of the variable,more adjustive,lot of statistics about the dataset*/ var &var; title 'Vivid Analysis of the data';/*it also gives you an idea of how this dataset is distibuted i.e symmetric or unsymmetric*/ run; quit; /*to check the normality of the dataset*/ proc univariate data=work.analysis_&data; var &var; histogram &var; /* histogram is basically a one way of presenting your data in a graphical form, different value in x axis and corresponding count on y axis,distribution of data across values,default is that the normality is a basic criteria*/ run; proc univariate data=work.analysis_&data normal plot; /*alternative way to check normality*/ var &var; histogram &var; qqplot &var/normal (mu=est sigma=est color=green); run; ods graphics on; proc gplot data=work.analysis_&data; plot &var * &var1; run; quit; %end ; %else %do; /*variable exploration using proc freq as count on categories because categorical variable std,mean wont make sense*/ proc freq data=work.analysis_&data /*better to have a uniform frequencies between categorical variables*/; table &var; title 'Frequency Analysis'; run; /*Chisquare test of independence of attributes*/ proc freq data=work.analysis_&data; tables &var * &var1/chisq; run; proc freq data=work.analysis_&data; table &var * &var1; run; %end ; %mend eda_analysis; %eda_analysis(data=class,var=height); Second macro :-.............. data lal; set sashelp.class; run ; %macro lst(datasetname); %local datasetid count rc; %global x; %let x=; /* Open the data set */ %let datasetid=%sysfunc(open(&datasetname)); /* The variable count will contain the number of variables that are in the */ /* data set that is passed in. */ %let count=%sysfunc(attrn(&datasetid,nvars)); /* Create a macro variable that contains all dataset variables */ %do i = 1 %to &count; %let x=&x %sysfunc(varname(&datasetid,&i)); %end; /* Close the data set */ /* %let rc=%sysfunc(close(&datasetid)); */ %mend lst; /* Pass in the name of the data set */ %lst(lal) %put macro variable x cotains the list= &x; Now I want implemented this macro inside a single macro so that whenever a user gives a dataset name and the variable to be analyzed it will perform according to it. Thanks
... View more