data abhi;
input a b c d ;
datalines;
1 2 6 .
2 3 8 .
3 5 9 .
4 6 2 .
5 8 1 .
;
proc print data = abhi;
run;
re
results:
a b c d
1 2 6 .
2 3 8 .
3 5 9 .
4 6 2 .
Here we have d which is not having a blank value. Now I want to add some dummy values into the 'd' sas field after this step.
and results should look like given below. Please help me on this.
Dummy values are:
5
6
7
8
results should looks like.
a b c d
1 2 6 5
2 3 8 6
3 5 9 7
4 6 2 8
Not Sure I understand what you mean.
data abhi;
input a b c d ;
datalines;
1 2 6 .
2 3 8 .
3 5 9 .
4 6 2 .
;
data Dummy;
input Dummy;
cards;
5
6
7
8
;
run;
data want;
merge abhi Dummy(rename=(Dummy=d));
run;
Thanks. you understand correctly. but i dont want to use cards or datalines. Can you please do the same without cards or datalines.
Tyagii schrieb:
Thanks. you understand correctly. but i dont want to use cards or datalines. Can you please do the same without cards or datalines.
To suggest any datasource other than datalines/cards you have to explain where the dummy-values come from.
Using output-statement is always possible ...
data Dummy;
Dummy = 5; output;
Dummy = 6; output;
/* ... */
;
run;
Hi,
Like (Note the use of indentation, and finishing a datastep/procedure correctly with run; or quit;) - code can be placed in posts using the {i} in the toolbar.
data abhi; input a b c d; d=_n_+4; datalines; 1 2 6 . 2 3 8 . 3 5 9 . 4 6 2 . 5 8 1 . ; run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.