SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
_el_doredo
Quartz | Level 8

Hello Experts,

 

I am having 3 dataset under TEMPO library.

Dataset 1 name: Temp1 has 3 variables

Dataset 2 name: Temp2 has 4 variables

Dataset 3 name: Temp3 has 5 variables

 

In my new dataset called FINAL. I am having two variable names and i want all the variable names from Temp1,Temp2 and Temp2 dataset to be observation of this FINAL dataset.

 

I  want my output like this

 

Variable_Name Dataset_Name
Name Temp1
ID Temp1
Amount Temp1
Address Temp2
SSN Temp2
Product Temp2
Discount Temp2
MRP Temp3
Cust_id Temp3
Ref Temp3
Outstanding_amt Temp3
status Temp3

 

Thanks in Advance

 

1 ACCEPTED SOLUTION

Accepted Solutions
AMSAS
SAS Super FREQ

Hi @_el_doredo 

You have a couple of simple options:

  1. PROC CONTENTS / PROC DATASETS
  2. Dictionary Tables

Here's an example

/* Create sample data */
data temp1 (keep=temp1var1 temp1var2) temp2(keep=temp2var1 temp2var2) temp3 (keep=temp3var1 temp3var2);
	temp1var1=1 ;
	temp1var2="test" ;
	temp2var1=1 ;
	temp2var2="test" ;
	temp3var1=1 ;
	temp3var2="test" ;

	output temp1 temp2 temp3 ;
run ;

data work.want ;
	set sashelp.vcolumn ;
	where libname="WORK" and memname in ("TEMP1","TEMP2","TEMP3") ;
run ;

View solution in original post

2 REPLIES 2
AMSAS
SAS Super FREQ

Hi @_el_doredo 

You have a couple of simple options:

  1. PROC CONTENTS / PROC DATASETS
  2. Dictionary Tables

Here's an example

/* Create sample data */
data temp1 (keep=temp1var1 temp1var2) temp2(keep=temp2var1 temp2var2) temp3 (keep=temp3var1 temp3var2);
	temp1var1=1 ;
	temp1var2="test" ;
	temp2var1=1 ;
	temp2var2="test" ;
	temp3var1=1 ;
	temp3var2="test" ;

	output temp1 temp2 temp3 ;
run ;

data work.want ;
	set sashelp.vcolumn ;
	where libname="WORK" and memname in ("TEMP1","TEMP2","TEMP3") ;
run ;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 877 views
  • 0 likes
  • 2 in conversation