BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
anitapamu2
Calcite | Level 5

Data one; input var1 $;

datalines;

scan

MRI

;run;

Data two; input res1 res2;

datalines;

10

45

13

56

; run;

 

OUTPUT: IN ONE DATASET

Var1 res1 res2

scan 10 45

scan 13 56

MRI 10 45

MRI 13 56

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

The SQL solution already posted is easier, but for a DATA step:

 

data want;

   set one;

   do _n_=1 to _nobs_;

      set two point=_n_ nobs=_nobs_;

      output;

   end;

run;

 

View solution in original post

3 REPLIES 3
Patrick
Opal | Level 21

Please provide valid and tested SAS syntax creating DATA ONE and DATA TWO.

 

Untested (as I didn't feel like fixing the data steps)

proc sql;
  create table want as
  select *
  from one,two
  ;
quit;

 

anitapamu2
Calcite | Level 5

Hereafter It will not repeat and Thank you!

 

Can you please help out In Data Step Method ...for the same Problem

Astounding
PROC Star

The SQL solution already posted is easier, but for a DATA step:

 

data want;

   set one;

   do _n_=1 to _nobs_;

      set two point=_n_ nobs=_nobs_;

      output;

   end;

run;

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 3 replies
  • 890 views
  • 0 likes
  • 3 in conversation