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

what do the sas log messages "numeric values have been converted to character" mean? : Sas programming

997


What is maximum number of rows and cols can be handled in SAS?

1521


Explain the use of proc gplot? : sas-grid-administration

952


What is a method to debug and test your SAS program?

1308


How might you use MOD and INT on numeric to mimic SUBSTR on character Strings?

1330


If a variable contains only numbers, can it be a character data type?

1046


What is the length assigned to the target variable by the scan function?

1127


How would you invoke a macro? : sas-macro

1064


what is scheduling and how will u implement it. In scheduling 5 jobs r running if there is an error occured at 3rd job and how will u check and waht necessary steps will u take not to repeat the same mistake

2308


What is the good sas programming practices for processing large data sets?

1087


In sas, what are the areas that you are most interested in? : sas-grid-administration

1041


What is the difference between the proc sql and data step?

1135


What is the difference between %put and symbolgen? : sas-macro

1195


What is the difference between where and if statement?

1089


what is SAS OPTIMIZATION?

2257