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

Name and describe few sas character functions that are used for data cleaning in brief.

1123


Name validation tools used in SAS

1184


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

1136


What is the difference between where and if statement?

1116


Mention what is the difference between nodupkey and nodup options?

1012


What was the last computer book you purchased? Why?

2374


Given an unsorted data set, how to read the last observation to a new data set?

1355


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

1038


Differentiate between proc means and proc summary.

1062


Explain what is SAS informats?

1094


How do you convert basic cube to transaction cube and transaction cube to basic cube?

2233


explain the key concept of sas? : Sas-administrator

1007


What is the function of output statement in a SAS Program?

1074


why a stop statement is needed for the point= option on a set statement?

1080


what can you learn from the sas log when debugging? : Sas programming

1089