BookmarkSubscribeRSS Feed
niteshbharadwaj
Fluorite | Level 6

Hi Folks,

 

I have two libraries named in1 & in2 both consist the datasets with same naming convention .For eg: test1 & test1

i.e in1.test1 & in2.test1.

Though the naming convention is same fields inside the datasets may or may not differ.

 

suppose I have added two fields named age and place in the source file. and they will reflect in both the datasets with same or different values ,because they might be separated on basis of key identifiers.

 

Could you please help me how to find the values for added fields w.r.t to library in the same sas program.

 

Thanks

Nitesh

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Do you just need to "print" them?  If so you can use:

proc report data=in1.test1 nowd;
  columns _all_;
run;

The _all_ will use all available columns.

 

If you need to do something more complicated, then you would consult the metadata tables, e.g. this would get you all variables found in both library in1 and 2, and datasets test1 and 2:

data want;
  set sashelp.vcolumn (where=(libname in ("IN1","IN2") and memname in ("TEST1","TEST2")));
run;
ballardw
Super User

Or

 

Proc print data=<any valid data set name>;

run;

 

Will print the entire data set, all values all rows.

 

Or you need to show by concrete example what you mean for output.

 

Once you have created a data set the only way to tell "new" variables, if this is the core of your question and not printing, then you would have to preserve a list of variables from the "old" data set.

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