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

At times I use data steps to subset my full database. When I then try to return to the full database with a proc corr, the database is still a subset even though there is no where statement to subset it. This happened even when I pasted the un subsetted code into a new program without the preceding data step. 

 

*Standardizing the CVD and risk factors;
*Low FSVV cohort: FSVV2 < 567.2738 for multiple regression;
data Projects.source;
set Projects.source;
Where FSVV2 < 567.2738;
CVD2017ms=CVD2017m/282.8077 - 2.05765;
.
.
. run; quit; Subsequently a new program: libname Projects "/home/u43393119/Projects"; proc sort data=Projects.source; by weighted_no; run; quit; *Table 1 Low FSVV multiple regression: subsetting code removed; proc corr data=Projects.source fisher ; *Where FSVV2 < 567.2738; *Where FSVV2 < 567.2738 or CVD2017m2 le 292.96526; var CVD2017m2 LDLC17 FSVV FSVV2 pmeat17KC . . . with CVD2017m; run; quit;

I use SAS on Demand for Academics. SAS 9.4. 

What is the fix?

Thanks. 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
data Projects.source;
set Projects.source;


You have the input data set and the output data set name set as the same. So that replaces your original data set source with the filtered data set, so SAS overwrites your original file.

You should probably drop the library and use the WORK library instead.

data source;
set projects.source;
....

run;


You will have to recreate your original data set.

 


@dkcundiffMD wrote:

At times I use data steps to subset my full database. When I then try to return to the full database with a proc corr, the database is still a subset even though there is no where statement to subset it. This happened even when I pasted the un subsetted code into a new program without the preceding data step. 

 

*Standardizing the CVD and risk factors;
*Low FSVV cohort: FSVV2 < 567.2738 for multiple regression;
data Projects.source;
set Projects.source;
Where FSVV2 < 567.2738;
CVD2017ms=CVD2017m/282.8077 - 2.05765;
.
.
. run; quit; Subsequently a new program: libname Projects "/home/u43393119/Projects"; proc sort data=Projects.source; by weighted_no; run; quit; *Table 1 Low FSVV multiple regression: subsetting code removed; proc corr data=Projects.source fisher ; *Where FSVV2 < 567.2738; *Where FSVV2 < 567.2738 or CVD2017m2 le 292.96526; var CVD2017m2 LDLC17 FSVV FSVV2 pmeat17KC . . . with CVD2017m; run; quit;

I use SAS on Demand for Academics. SAS 9.4. 

What is the fix?

Thanks. 


 

View solution in original post

2 REPLIES 2
Reeza
Super User
data Projects.source;
set Projects.source;


You have the input data set and the output data set name set as the same. So that replaces your original data set source with the filtered data set, so SAS overwrites your original file.

You should probably drop the library and use the WORK library instead.

data source;
set projects.source;
....

run;


You will have to recreate your original data set.

 


@dkcundiffMD wrote:

At times I use data steps to subset my full database. When I then try to return to the full database with a proc corr, the database is still a subset even though there is no where statement to subset it. This happened even when I pasted the un subsetted code into a new program without the preceding data step. 

 

*Standardizing the CVD and risk factors;
*Low FSVV cohort: FSVV2 < 567.2738 for multiple regression;
data Projects.source;
set Projects.source;
Where FSVV2 < 567.2738;
CVD2017ms=CVD2017m/282.8077 - 2.05765;
.
.
. run; quit; Subsequently a new program: libname Projects "/home/u43393119/Projects"; proc sort data=Projects.source; by weighted_no; run; quit; *Table 1 Low FSVV multiple regression: subsetting code removed; proc corr data=Projects.source fisher ; *Where FSVV2 < 567.2738; *Where FSVV2 < 567.2738 or CVD2017m2 le 292.96526; var CVD2017m2 LDLC17 FSVV FSVV2 pmeat17KC . . . with CVD2017m; run; quit;

I use SAS on Demand for Academics. SAS 9.4. 

What is the fix?

Thanks. 


 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 488 views
  • 1 like
  • 2 in conversation