By stopping before you output and if you want before you read any obs. Use the STOP statement.
data likeshoes;
stop;
set sashelp.shoes;
run;
Log:
NOTE: The data set WORK.LIKESHOES has 0 observations and 7 variables.
Other methods - use OBS=0 on the SET statement, or PROC SQL with the LIKE statement.
data likeshoes;
set sashelp.shoes (obs=0);
run;
proc sql;
create table test like sashelp.shoes;
quit;
By stopping before you output and if you want before you read any obs. Use the STOP statement.
data likeshoes;
stop;
set sashelp.shoes;
run;
Log:
NOTE: The data set WORK.LIKESHOES has 0 observations and 7 variables.
Other methods - use OBS=0 on the SET statement, or PROC SQL with the LIKE statement.
data likeshoes;
set sashelp.shoes (obs=0);
run;
proc sql;
create table test like sashelp.shoes;
quit;
Datastep:
Method1:
data data2;
set sashelp.class(obs=0);
run;
proc print data=data2;
run;
Method2:
data data3;
stop;
set sashelp.class;
run;
SQL :
proc sql;
create table data4 like sashelp.class;
quit;
To create a zero observation dataset with column specifications:
DATA work.MEMBER;
LENGTH NAME $ 28 DOB 4;
FORMAT DOB DATE9.;
INFORMAT DOB DATE9.;
STOP;
RUN;
It is same like Create Table doing PROC SQL.
proc sql;
create table work.member
(Name varchar(28) ,
DOB num format date9.
);
quit;
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.