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

List out some key concept of SAS

1138


What are the differences between proc means and proc summary?

1150


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

1142


what is data access? : Sas-di

1150


which date functions advances a date time or date/time value by a given interval? : Sas programming

973


What is SAS informats?

1114


What is SAS? What are the functions does it performs?

1206


explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di

1087


Explain what Proc glm does?

1223


What would be the result of the following SAS function (given that 31 Dec, 2000 is Sunday)?

1164


To what type of programms have you used scratch macros?

2575


What is run-group processing?

1180


how the sas basic syntax style described? : Sas-administrator

1027


what is intially documentation in sas?

5060


How do you specify the number of iterations and specific condition within a single do loop?

1114