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

Mention how to limit decimal places for the variable using proc means?

1169


What are the new features included in the new version of SAS Programming Language?

1244


what is hierarchy flattening? : Sas-di

1132


List down the reasons for choosing sas over other data analytics tools.

1329


Difference between informat and format?

1141


What is SAS?

1095


explain the function of substr in sas? : Sas-administrator

1062


What are the different servers in sas? : sas-grid-administration

1099


what is enterprise guide? What is the use of it? : Sas programming

1064


Tell me more about the parameters in macro? : sas-macro

1089


What are the implications?

1781


What does proc print, and proc contents are used for?

1214


What is auto call macro and how to create a auto call macro? What is the use of it? How to use it in sas with macros? : sas-macro

1072


How would you code a macro statement to produce information on the sas log? This statement can be coded anywhere? : sas-macro

1097


What is the purpose of trailing @ and @@? How do you use them?

1082