Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how we can call macros with in data step?

Answer Posted / pambrose

here is the answer with self explaining code... picked from SAS book

data prices; /* ID for price category and actual price */
input code amount;
datalines;
56 300
99 10000
24 225
;

data names; /* name of sales department and item sold */
input dept $ item $;
cards;
BB Boat
SK Ski
;
%macro items(codevar=); /* create macro variable if needed */
%global special;
data _null_;
set names;
if &codevar=99 and dept='BB' then
call symput('special', item);
run;
%mend items;

data _null_; /* call the macro in this step */
set prices;
if amount > 500 then
call execute('%items(codevar=' || code || ')' );
run;

data sales; /* use the value created by the macro in this step */
set prices;
length saleitem $ 20;
saleitem="&special";
run;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you suggest us materials for sdtm mapping?

4438


what is information maps?

2213


for whom is sas data integration studio designed? : Sas-di

993


How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data?

1087


describe how to adjust the performance of data integrator? : Sas-di

999


what is hash files in sas and why we are using this one in sas?

2205


describe about metadata object? : Sas-di

1060


How you are maintaining sas programmes in your company...any specific version control software you are using? If so, tell me the name?

2113


What are the 3 components in sas programming?

1190


where to use sas business intelligence? : Sas-bi

1075


What is factor analysis?

1125


Did you used proc test? when?

2030


How to specify variables to be processed by the freq procedure?

1067


If you have a dataset that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables?

1155


How to create list output for cross-tabulations in proc freq?

1104