SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
dht115
Calcite | Level 5

Hello, 

 

I need to create a table based on observation and keep the table name. 

data test1;
input var1 $;
datalines;
a
b
c
;
run;

data test2;
input var1 $;
datalines;
a
b
c
d
;
run;

My output should be: 

 

dht115_0-1671203662179.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ
data test1;
input var1 $;
datalines;
a
b
c
;
run;

data test2;
input var1 $;
datalines;
a
b
c
d
;
run;

PROC SQL noprint;
 create table work.wanted as
 select memname , nobs 
 from dictionary.tables
 where LIBNAME='WORK' and memname in ('TEST1','TEST2') and memtype='DATA';
QUIT;
/* end of program */

Koen

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Huh?

Are you asking how to find out how many observations are in your datasets?

proc sql ;
create tables want as
select libname,memname,nobs from dictionary.tables
  where libname='WORK'
;
quit;

proc print;
run;
sbxkoenk
SAS Super FREQ
data test1;
input var1 $;
datalines;
a
b
c
;
run;

data test2;
input var1 $;
datalines;
a
b
c
d
;
run;

PROC SQL noprint;
 create table work.wanted as
 select memname , nobs 
 from dictionary.tables
 where LIBNAME='WORK' and memname in ('TEST1','TEST2') and memtype='DATA';
QUIT;
/* end of program */

Koen

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 918 views
  • 0 likes
  • 3 in conversation