BookmarkSubscribeRSS Feed
Tyagii
Calcite | Level 5

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

1 REPLY 1
ballardw
Super User

Do you have your "dummy" values in a dataset? If so, are they a one-to-one match for the base data (the first dummy value goes with the first record in base data)?

If so:

Data want;
   merge abgu dummydata;
run

Should work.

 

If you don't have the dummy values in a data set then make one.

If the relationship is NOT one-to-one you will need to provide explicit rules on how to assign the first "dummy" value to the correct record(s) in the base dataset.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 757 views
  • 0 likes
  • 2 in conversation