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 execute macro within another macro? If so, how would sas know where the current macro ended and the new one began? : sas-macro

1132


What is Linear Regression?

1104


what are the types of interactive display types? : Sas-bi

1037


Hi all, If Anybody has Advance SAS Certification dumps??? Please share with me. Email: pramod.kalugade03@gmail.com

1977


what are the best practices to process the large data sets in sas programming? : Sas-administrator

960


what is information maps?

2154


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

1059


what is the Population you used in your project, is it ITT or PP?

2680


how does sas handle missing values in a merge? : Sas programming

983


what has been your most common programming mistake? : Sas programming

1030


In sas admin differentiate between roles and capabilities? : sas-grid-administration

939


What makes sas stand out to be the best over other data analytics tools?

1003


Define run-group processing?

980


How long can a macro variable be? A token? : sas-macro

1155


Tell e how how dealt with..

2200