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

I am unable to run code to call my data, I believe that is why my data does not exist. I have tried 

a libname statement as well as proc import but I cannot seem to be able to create the correct pathway

 

 

Log: 
 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         *************Starter code************************;
 70         PROC SQL;
 71         CREATE TABLE WORK.query AS
 72         SELECT ID , Match_ID , Sex , Ethnic , dmincagen , Smoke , Baseage , BMI_GS , BMI_SR , 'Case'n FROM
 72       ! _TEMP0.case_control_analysis;
 NOTE: Data file _TEMP0.CASE_CONTROL_ANALYSIS.DATA is in a format that is native to another host, or the file encoding does not 
       match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and 
       might reduce performance.
 NOTE: Table WORK.QUERY created, with 568 rows and 10 columns.
 
 73         RUN;
 NOTE: PROC SQL statements are executed immediately; The RUN statement has no effect.
 74         QUIT;
 NOTE: PROCEDURE SQL used (Total process time):
       real time           0.00 seconds
       user cpu time       0.01 seconds
       system cpu time     0.00 seconds
       memory              5891.84k
       OS Memory           35752.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        425  Switch Count  2
       Page Faults                       0
       Page Reclaims                     85
       Page Swaps                        0
       Voluntary Context Switches        19
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           264
       
 
 75         
 76         PROC DATASETS NOLIST NODETAILS;
 77         CONTENTS DATA=WORK.query OUT=WORK.details;
 78         RUN;
 
 NOTE: The data set WORK.DETAILS has 10 observations and 41 variables.
 79         
 
 NOTE: PROCEDURE DATASETS used (Total process time):
       real time           0.04 seconds
       user cpu time       0.04 seconds
       system cpu time     0.00 seconds
       memory              2327.15k
       OS Memory           31408.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        426  Switch Count  2
       Page Faults                       0
       Page Reclaims                     189
       Page Swaps                        0
       Voluntary Context Switches        14
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           288
       
 
 80         PROC PRINT DATA=WORK.details;
 81         RUN;
 
 NOTE: There were 10 observations read from the data set WORK.DETAILS.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.08 seconds
       user cpu time       0.09 seconds
       system cpu time     0.01 seconds
       memory              1062.28k
       OS Memory           30888.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        427  Switch Count  0
       Page Faults                       0
       Page Reclaims                     62
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      1
       Block Input Operations            0
       Block Output Operations           32
       
 
 82         
 83         
 84         ********Question 1A. Looking for duplicate subjects***;
 85         proc means data = work.details; run;
 
 NOTE: There were 10 observations read from the data set WORK.DETAILS.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.08 seconds
       user cpu time       0.08 seconds
       system cpu time     0.00 seconds
       memory              6135.46k
       OS Memory           36020.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        428  Switch Count  1
       Page Faults                       0
       Page Reclaims                     1345
       Page Swaps                        0
       Voluntary Context Switches        19
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           16
       
 
 86         
 87         ********Question 1B. Histogram*****;
 88         PROC UNIVARIATE data=work.query;
 89         var Baseage dmincagen;
 90         histogram ;
 91         run;
 
 NOTE: PROCEDURE UNIVARIATE used (Total process time):
       real time           0.25 seconds
       user cpu time       0.18 seconds
       system cpu time     0.01 seconds
       memory              13003.75k
       OS Memory           40964.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        429  Switch Count  0
       Page Faults                       0
       Page Reclaims                     3239
       Page Swaps                        0
       Voluntary Context Switches        228
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           776
       
 
 92         
 93         ********Question 1C. Distribution of age at baseline and BMI by case status***;
 94         
 95         
 96         
 97         Proc SGplot data = Case_Control_0;
 98         by case;
 ERROR: Variable CASE not found.
 99         histogram bmi_gs;
 ERROR: Variable BMI_GS not found.
 100        density bmi_gs;
 ERROR: Variable BMI_GS not found.
 101        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SGPLOT used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              379.03k
       OS Memory           39076.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        430  Switch Count  0
       Page Faults                       0
       Page Reclaims                     17
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 102        
 103        
 104        
 105        
 106        *************Question Task 2 ***************************;
 
 
 107        Proc freq data= Case_Control;
 ERROR: File WORK.CASE_CONTROL.DATA does not exist.
 108        tables case *(ethnic sex smoke)/chisq;
 ERROR: No data set open to look up variables.
 ERROR: No data set open to look up variables.
 ERROR: No data set open to look up variables.
 ERROR: No data set open to look up variables.
 109        
 110        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE FREQ used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              184.34k
       OS Memory           39076.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        431  Switch Count  0
       Page Faults                       0
       Page Reclaims                     44
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 111        
 112        ************************* Task 2 continous variable mean age SD**** ;
 113        
 
 
 114        proc ttest data= Case_Control;;
 ERROR: File WORK.CASE_CONTROL.DATA does not exist.
 115        class case;
 116        var Baseage;
 117        
 118        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE TTEST used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              305.46k
       OS Memory           39076.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        432  Switch Count  0
       Page Faults                       0
       Page Reclaims                     14
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 119        
 120        ************Task 3a**********************;
 121        
 
 
 122        Proc corr data = Case_Control;
 ERROR: File WORK.CASE_CONTROL.DATA does not exist.
 123        var BMI_SR BMI_GS;
 124        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE CORR used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              292.56k
       OS Memory           39076.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        433  Switch Count  0
       Page Faults                       0
       Page Reclaims                     15
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 125        
 126        
 127        
 128        
 
 
 129        Proc SGplot data = Case_Control;
 ERROR: File WORK.CASE_CONTROL.DATA does not exist.
 130        Reg X = BMI_SR y = BMI_GS;
 ERROR: No data set open to look up variables.
 ERROR: No data set open to look up variables.
 131        label BMI_SR = "Self-Report BMI";
 132        label BMI_GS = "Gold-Standard BMI";
 133        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE SGPLOT used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              213.59k
       OS Memory           39076.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        434  Switch Count  0
       Page Faults                       0
       Page Reclaims                     17
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 134        
 135        ***********Task 3b************************;
 136        
 
 
 137        proc means data = Case_Control mean std;
 ERROR: File WORK.CASE_CONTROL.DATA does not exist.
 138        Var BMI_SR BMI_GS;
 ERROR: No data set open to look up variables.
 ERROR: No data set open to look up variables.
 139        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE MEANS used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              318.84k
       OS Memory           39076.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        435  Switch Count  0
       Page Faults                       0
       Page Reclaims                     15
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 140        
 141        ******Hint: Bias = mean difference, Upper limit = Bias + 1.96*Stdev of Difference, Lower Limit = Bias - 1.96*Stdev of
 141      ! Difference. Use this information to complete the code below.****;
 142        
 
 
 143        Proc SGplot data = work.query;
 144        scatter X = BMI_GS Y = BMI_SR;
 145        label BMI_GS = "Gold-Standard BMI Measure";
 146        label Diff = "Gold-Standard - Self-Report";
 WARNING: Variable DIFF not found in data set WORK.QUERY.
 147        refline 0 / transparency = 0.1 lineattrs=(color=black pattern =1 thickness =3);
 148        refline 7/ transparency = 0.1 Label = ('Upper Limit of Agreement')  lineattrs=(color=red pattern=2 thickness =3);
 149        refline 3/ transparency = 0.1 Label = ('Lower Limit of Agreement')  lineattrs=(color=red pattern=2 thickness =3);
 150        refline 4 / transparency = 0.1 Label = ('Bias')  lineattrs=(color=red thickness =3);
 151        run;
 
 NOTE: PROCEDURE SGPLOT used (Total process time):
       real time           0.08 seconds
       user cpu time       0.04 seconds
       system cpu time     0.01 seconds
       memory              1519.93k
       OS Memory           40240.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        436  Switch Count  1
       Page Faults                       0
       Page Reclaims                     312
       Page Swaps                        0
       Voluntary Context Switches        132
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           472
       
 NOTE: There were 568 observations read from the data set WORK.QUERY.
 
 152        
 153        ***************4********;
 NOTE: PROCEDURE LOGISTIC used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              79.25k
       OS Memory           38820.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        437  Switch Count  0
       Page Faults                       0
       Page Reclaims                     16
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 ERROR: File WORK.CASE_CONTROL_1.DATA does not exist.
 NOTE: The SAS System stopped processing this step because of errors.
 154        Proc logistic data = Case_Control_1;
 155        class Match_ID BMI_GS_Cat(ref='0') ethnic;
 156        model Case (event = '1') = BMI_GS_Cat ethnic baseage;
 157        strata Match_ID;
 158        run;
 159        
 160        
 161        
 162        *****************5***********************;
 163        *Non-differential Misclassification;
 
 
 NOTE: PROCEDURE LOGISTIC used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              190.81k
       OS Memory           38820.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        438  Switch Count  0
       Page Faults                       0
       Page Reclaims                     16
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 ERROR: File WORK.CASE_CONTROL.DATA does not exist.
 NOTE: The SAS System stopped processing this step because of errors.
 164        Proc logistic data = Case_Control;
 165        class Match_ID BMI_SR_Cat(ref='0') ethnic;
 166        model Case (event = '1') = BMI_SR_Cat baseage ethnic;
 167        strata Match_ID;
 168        run;
 169        
 170        
 171        
 172        
 173        
 174        ******************6a********************;
 
 
 175        Data Case_Control_2;
 176        set Case_Control_1;
 ERROR: File WORK.CASE_CONTROL_1.DATA does not exist.
 177        if Case = 1 then BMI_DM_cat = BMI_GS_Cat; *cases measured via gold-standard;
 178        else if Case = 0 Then BMI_DM_Cat = BMI_SR_cat; *controls measured via self-report;
 179        run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.CASE_CONTROL_2 may be incomplete.  When this step was stopped there were 0 observations and 4 variables.
 WARNING: Data set WORK.CASE_CONTROL_2 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              631.15k
       OS Memory           39080.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        439  Switch Count  0
       Page Faults                       0
       Page Reclaims                     60
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           8
       
 
 180        
 181        *showing the effect of the Differential Misclassification;
 NOTE: PROCEDURE LOGISTIC used (Total process time):
       real time           0.00 seconds
       user cpu time       0.00 seconds
       system cpu time     0.00 seconds
       memory              299.87k
       OS Memory           39080.00k
       Timestamp           04/14/2022 03:34:06 PM
       Step Count                        440  Switch Count  0
       Page Faults                       0
       Page Reclaims                     50
       Page Swaps                        0
       Voluntary Context Switches        0
       Involuntary Context Switches      0
       Block Input Operations            0
       Block Output Operations           0
       
 ERROR: Variable MATCH_ID not found.
 ERROR: Variable ETHNIC not found.
 NOTE: The SAS System stopped processing this step because of errors.
 182        Proc logistic data = Case_Control_2;
 183        class Match_ID BMI_DM_cat(Ref='0') ethnic;
 184        model Case (event = '1') = BMI_DM_cat ethnic baseage;
 185        strata Match_ID;
 186        run;
 187        
 188        
 189        OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 199  

questions. When trying to run the code my variables are not found and my data does not exist. I have tried adding a libname, I have also tried using commands such as ProcImport and Datafile and I can not find the correct way to call my data. 

My log and code are attached. 

*************Starter code************************; 
PROC SQL;
CREATE TABLE WORK.query AS
SELECT ID , Match_ID , Sex , Ethnic , dmincagen , Smoke , Baseage , BMI_GS , BMI_SR , 'Case'n FROM _TEMP0.case_control_analysis;
RUN;
QUIT;

PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;


********Question 1A. Looking for duplicate subjects***; 
proc means data = work.details; run; 

********Question 1B. Histogram*****; 
PROC UNIVARIATE data=work.query;
var Baseage dmincagen; 
histogram ;
run; 

********Question 1C. Distribution of age at baseline and BMI by case status***;



Proc SGplot data = Case_Control_0;
by case;
histogram bmi_gs;
density bmi_gs; 
run;




*************Question Task 2 ***************************;
Proc freq data= Case_Control;
tables case *(ethnic sex smoke)/chisq;

run;

************************* Task 2 continous variable mean age SD**** ;

proc ttest data= Case_Control;; 
class case; 
var Baseage;

run; 

************Task 3a**********************;

Proc corr data = Case_Control;
var BMI_SR BMI_GS;
run;




Proc SGplot data = Case_Control;
Reg X = BMI_SR y = BMI_GS;
label BMI_SR = "Self-Report BMI";
label BMI_GS = "Gold-Standard BMI";
run;

***********Task 3b************************;

proc means data = Case_Control mean std;
Var BMI_SR BMI_GS;
run;

******Hint: Bias = mean difference, Upper limit = Bias + 1.96*Stdev of Difference, Lower Limit = Bias - 1.96*Stdev of Difference. Use this information to complete the code below.****; 

Proc SGplot data = work.query;
scatter X = BMI_GS Y = BMI_SR;
label BMI_GS = "Gold-Standard BMI Measure";
label Diff = "Gold-Standard - Self-Report";
refline 0 / transparency = 0.1 lineattrs=(color=black pattern =1 thickness =3);
refline 7/ transparency = 0.1 Label = ('Upper Limit of Agreement')  lineattrs=(color=red pattern=2 thickness =3);
refline 3/ transparency = 0.1 Label = ('Lower Limit of Agreement')  lineattrs=(color=red pattern=2 thickness =3);
refline 4 / transparency = 0.1 Label = ('Bias')  lineattrs=(color=red thickness =3);
run;

***************4********;
Proc logistic data = Case_Control_1;
class Match_ID BMI_GS_Cat(ref='0') ethnic;
model Case (event = '1') = BMI_GS_Cat ethnic baseage;
strata Match_ID;
run;



*****************5***********************;
*Non-differential Misclassification;
Proc logistic data = Case_Control;
class Match_ID BMI_SR_Cat(ref='0') ethnic;
model Case (event = '1') = BMI_SR_Cat baseage ethnic;
strata Match_ID;
run;





******************6a********************; 
Data Case_Control_2;
set Case_Control_1;
if Case = 1 then BMI_DM_cat = BMI_GS_Cat; *cases measured via gold-standard;
else if Case = 0 Then BMI_DM_Cat = BMI_SR_cat; *controls measured via self-report;
run;

*showing the effect of the Differential Misclassification;
Proc logistic data = Case_Control_2;
class Match_ID BMI_DM_cat(Ref='0') ethnic;
model Case (event = '1') = BMI_DM_cat ethnic baseage;
strata Match_ID;
run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Right, so SAS finds data set CASE_CONTROL_0, that's not the problem. SAS doesn't find the variables named in your program inside that data set.

--
Paige Miller

View solution in original post

8 REPLIES 8
PaigeMiller
Diamond | Level 26

When SAS can't find a data set, you have to find it. It may be that you spelled the name of the data set wrong, or it may be that you need to use the proper LIBNAME and libref (i.e. two-word name for the data set). 

 

You can browse your Explorer window on the left where you can list all the data sets availabe, and see if you can find the data set; if you have misspelled the name, then it shouldn't be that hard to fix. If its not in a library that exists in your SAS, then you don't have the right LIBNAME for it, you probably need to see your instructor to get instructions on where to find it and what the right LIBNAME is.

--
Paige Miller
Guerraje
Quartz | Level 8
Question 1A and 1B run just fine and those are working in work. details and work.query,

It is when I get to 1C.
Proc SGplot data = Case_Control_0;
case_control_0 is not found. However, work.Case_Control_0 is listed in my library just like the others
PaigeMiller
Diamond | Level 26

Show us a screen capture of this data set listed in your library. use the "Insert Photo" icon to include the screen capture in your reply.

--
Paige Miller
PaigeMiller
Diamond | Level 26

Right, so SAS finds data set CASE_CONTROL_0, that's not the problem. SAS doesn't find the variables named in your program inside that data set.

--
Paige Miller
Guerraje
Quartz | Level 8

It seemed to me, that those variables are in the work.query, when I run that I get output. My professor just said my code should be CASE_CONTROL_0 so I wanted to see if I was doing something wrong here. I will follow up with them on this. Thank you very much. Because even when I try to open that file I do not have variables inside. 

 

I appreciate your patience. Thank you

Kurt_Bremser
Super User

There is no CASE_CONTROL and CASE_CONTROL_1 dataset, as proven by your screenshot. These are the datasets that SAS complains about. Why do you think they should exist?

And you try to use variables in CASE_CONTROL_0 which are not there; run a PROC CONTENTS on this dataset to see the existing variable names.

You later want to use variable DIFF in WORK.QUERY. but your initial SQL query which creates this dataset does not create or select this variable.

Guerraje
Quartz | Level 8
I was provided all of the code and told these should be my names for everything for example "case_control_0" so that was what I was trying to figure out. Because I could not find a way to make this work, I am starting to wonder if that in fact is not true, so i need to further follow up with my professors on why this isnt working. Thank you

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 8 replies
  • 2862 views
  • 1 like
  • 3 in conversation