create macros---you have 365 number of data and you need to
merge it throw the macros,,,,,,

data file1;
input a @@;
cards;
1 2 3 4
;
run;

data file2;
input a @@;
cards;
5 6 7 8
;
run;
data file3;
input a @@;
cards;
9 10 11 12
;
run;data file4;
input a @@;
cards;
13 14 15 16
;
run;

Answers were Sorted based on User's Feedback



create macros---you have 365 number of data and you need to merge it throw the macros,,,,,, data..

Answer / jugaadu

Sorry missed the data step here is the corrected Version;


%MACRO Data_Create;
%Do i = 1 %to 365;
DATA file&i;
INPUT a @@;
CARDS;
4*&i-3 4*&i-2 4*&i-1 4*&i
;
RUN;
%MEND;

%Data_Create;

Is This Answer Correct ?    3 Yes 2 No

create macros---you have 365 number of data and you need to merge it throw the macros,,,,,, data..

Answer / venkat

%macro merging(f,x);
%do i=1 %to %eval(&x-1);
data &f&n;
merge &f&n &f%eval(&i+1);
by a;
run;
%end;
%mend merging;
%merging(file,4);

Is This Answer Correct ?    1 Yes 1 No

create macros---you have 365 number of data and you need to merge it throw the macros,,,,,, data..

Answer / ashutosh

%macro mydata(my,n);
data XXX;
merge
%do i=1 %to &n;
&my&i
%end;
;
by a;
run;
%mend;
%mydata(file,4);

Is This Answer Correct ?    0 Yes 0 No

create macros---you have 365 number of data and you need to merge it throw the macros,,,,,, data..

Answer / singh.naveen409

%macros mydata(my,n);
data www;
set
%do i=1 %to &n;
&my&i
end;
;
run;
%mend;
%mydata(file,4);

Is This Answer Correct ?    3 Yes 4 No

create macros---you have 365 number of data and you need to merge it throw the macros,,,,,, data..

Answer / vijay

%MACRO mer;
DATA file_all_365;
MERGE
%DO i=1 %TO 365;
file&i
%END;;
RUN;
%MEND;

%MER;

Is This Answer Correct ?    0 Yes 1 No

create macros---you have 365 number of data and you need to merge it throw the macros,,,,,, data..

Answer / jugaadu

%MACRO Data_Create;
%Do i = 1 %to 365;
INPUT a @@;
CARDS;
4*&i-3 4*&i-2 4*&i-1 4*&i
;
RUN;
%MEND;

%Data_Create;

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More SAS Interview Questions

what is difference in window SAS & Unix SAS.....how do define working environment in both???

1 Answers   JPMorgan Chase,


for report generation which one you used proc report or data_null_?

3 Answers   Accenture, Quintiles,


how to add distinctly var variable values ex.. Data a; input var; datalines; 0 1 2 3 -1 -2 -3 ; run; adding all +ve value in one varibale n do the same for -ve too

5 Answers   CTS,


what is SAS/Graph?

1 Answers   CitiGroup, NTPC,


for what purpose would you use the retain statement? : Sas programming

0 Answers  






what is SAS/Access and SAS/Connect?what are the uses?

3 Answers  


How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set?

2 Answers  


Do you need to know if there are any missing values?

0 Answers  


how do the in= variables improve the capability of a merge? : Sas programming

0 Answers  


Describe 5 ways to do a “table lookup” in SAS?

0 Answers  


what is business intelligence? : Sas-bi

0 Answers  


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

0 Answers  


Categories