Using SAS on demand for academic and SAS Studio, I am deriving a multiple regression formula of dietary and other risk factors for non-communicable diseases. My library is Products. In the middle of the process, I get the error that Products is not assigned.
Also, I partitioned the dataset with the following statement: Where FSVV2 < 351.5724;
After I close this file and go to the next, the data are still partitioned by Where FSVV2 < 351.5724;
How do I end the partition?
Thanks.
David Cundiff
SAS code:
libname Projects "/home/u43393119/Projects";
proc sort data=Projects.source;
by weighted_no;
run;
quit;
*Combination dietary risk factors derived;
data Projects.source;
set Projects.source;
FSVV=pmeat17KC + rmeat17KC + fish17KC + milk17KC + poultry16KC + eggs16KC
+ aSFA16KC + aPUFA17KC + aTFA17KC;
FSVV2=pmeat17KC2 + rmeat17KC2 + fish17KC2 + milk17KC2 + poultry16KC2 + eggs16KC2
+ aSFA16KC2+ aPUFA17KC2 + aTFA17KC2;
addedFat=aSFA16KC + aPUFA17KC + aTFA17KC;
addedFat2=aSFA16KC2 + aPUFA17KC2 + aTFA17KC2;
TotalKC=pmeat17KC + rmeat17KC + fish17KC + milk17KC + poultry16KC + eggs16KC + aSFA16KC
+ aPUFA17KC + aTFA17KC + alcohol17KC + Sugarb17KC + potatoes16KC + corn16KC
+ fruits17KC + Vegetables17KC + nutsseeds17KC + wgrains17KC + legumes17KC + rice16KC + swtpot16KC;
Label
FSVV=Fat-soluble vitamin variable
FSVV2=Fat-soluble vitamin variable m/f mean
TotalKC=Total Kcal/day data available;
*Standardizing the variables;
NCD17ms=NCD17m/399.68018 - 3.73754;
pmeat17KCs=pmeat17KC /0.87647 -1.77019;
rmeat17KCs=rmeat17KC /29.44548 - 1.09634;
fish17KCs=fish17KC /1.50615 - 1.85824;
milk17KCs=milk17KC /9.78892 - 1.29811;
poultry16KCs=poultry16KC /16.24909 - 1.25773;
eggs16KCs=eggs16KC /11.77554 - 1.17391;
aSFA16KCs=aSFA16KC /17.31454 - 4.36804;
aPUFA17KCs=aPUFA17KC /14.22874 - 1.56401;
aTFA17KCs=aTFA17KC /4.7895 - 1.00687;
Alcohol17KCs=Alcohol17KC /45.75517 - 1.50668;
Sugarb17KCs=Sugarb17KC /106.54402 - 2.65994;
potatoes16KCs=potatoes16KC /76.67565 - 0.98389;
corn16KCs=corn16KC /44.73077 - 0.7639;
fruits17KCs=fruits17KC /19.01693 - 1.74415;
Vegetables17KCs=Vegetables17KC /40.70559 - 1.7763;
nutsseeds17KCs=nutsseeds17KC /5.85482 - 1.09816;
wgrains17KCs=wgrains17KC /30.15109 - 1.84823;
legumes17KCs=legumes17KC /32.09786 - 1.7087;
rice16KCs=rice16KC /114.89232 - 1.51305;
swtpot16KCs=swtpot16KC /39.4746 - 0.75105;
VitAdeficms=VitAdeficm /9447 - 2.83083;
PAMETs17ms=PAMETs17m /1260 - 4.02677;
AmbientPM17ms=AmbientPM17m /23.18446 - 2.35202;
smoke17ms=smoke17m /0.19136 - 1.01969;
SLTobacco17ms=SLTobacco17m /0.10191 - 0.87387;
HHairPoll17ms=HHairPoll17m /0.23444 - 2.68993;
kidneydz17ms=kidneydz17m /0.02878 - 2.03845;
T1DM17ms=T1DM17m /10.05986 - 1.19509;
T2DM17ms=T2DM17m /14.24966 - 1.25353;
sex_IDs=sex_ID /0.50004 - 2.99976;
run;
*Table 1;
proc corr data=Projects.source fisher;
var NCD17ms FSVV FSVV2 pmeat17KC rmeat17KC fish17KC milk17KC poultry16KC eggs16KC aSFA16KC
aPUFA17KC aTFA17KC Alcohol17KC Sugarb17KC potatoes16KC corn16KC fruits17KC
Vegetables17KC nutsseeds17KC wgrains17KC legumes17KC rice16KC swtpot16KC
kcal2016m VitAdeficm sodium17m Calcium17m fiber17m PAMETs17m Childunwt17m
discbreastF17m AmbientPM17m smoke17m SHsmoke17m SLTobacco17m leadblood17m
HHairPoll17m kidneydz17m T1DM17m T2DM17m BMI17m LDLC17 FPG17m SBP17m
SDI_2016m sex_ID
pmeat17KCs rmeat17KCs fish17KCs milk17KCs poultry16KCs eggs16KCs aSFA16KCs
aPUFA17KCs aTFA17KCs Alcohol17KCs Sugarb17KCs potatoes16KCs corn16KCs fruits17KCs
Vegetables17KCs nutsseeds17KCs wgrains17KCs legumes17KCs rice16KCs swtpot16KCs
VitAdeficms PAMETs17ms AmbientPM17ms smoke17ms SLTobacco17ms HHairPoll17ms
kidneydz17ms T1DM17ms T2DM17ms sex_IDs
;
with NCD17m;
run; quit;
*Table 2: Finding the about 1-3 billion people with the lowest and highest
mean NCD male/female averaged;
data Projects.source;
set Projects.source;
Where FSVV2 < 351.5724;
NCD17f1=
- pmeat17KCs * 1.55152 * 0.006135589
- rmeat17KCs * 32.28236 * 0.013609556
- fish17KCs * 2.79879 * 0.022961341
+ milk17KCs * 12.70714 * 0.027785556
- poultry16KCs * 20.43698 * 0.080338234
- eggs16KCs * 13.8234 * 0.108609794
- aSFA16KCs * 75.63065 * 0.031915823
- aPUFA17KCs * 22.25392 * 0.069902072
- aTFA17KCs * 4.82242 * 1.45926E-08
+ Alcohol17KCs * 68.93836 * 0.123369538
+ Sugarb17KCs * 283.40041 * 0.015805518
- potatoes16KCs * 75.44008 * 0.005246105
- corn16KCs * 34.17002 * 0.003071376
- fruits17KCs * 33.1684 * 0.111389063
- Vegetables17KCs * 72.30542 * 0.010870148
- nutsseeds17KCs * 6.42952 * 0.012809712
- wgrains17KCs * 55.72616 * 0.013597892
+ legumes17KCs * 54.84575 * 0.032080392
- rice16KCs * 173.83774 * 0.008246456
- swtpot16KCs * 29.64738 * 0.059658063
;
NCD17f2=
+smoke17ms * 0.19513 * 0.1406325
+SLTobacco17ms * 0.08906 * 0.110164248
+HHairPoll17ms * 0.63063 * 0.03125824
;
NCD17f3=
+T1DM17ms *12.02246 * 0.161451276
+T2DM17ms * 17.86239 * 0.140392596
;
run; quit;
Proc reg data=Projects.source;
Where FSVV2 < 351.5724;
model NCD17ms=NCD17f1 NCD17f2 NCD17f3 PAMETs17ms AmbientPM17ms sex_ids
/ selection=STEPWISE slentry=.25 slstay=.25;
run; quit;
*NCD17f1 0.01066 0.00078537 78.74145 184.08 <.0001
NCD17f2 5.76168 0.45383 68.94733 161.18 <.0001
NCD17f3 0.11820 0.00263 864.77577 2021.63 <.0001
PAMETs17ms -0.14377 0.01079 76.00534 177.68 <.0001
AmbientPM17ms 0.19499 0.01298 96.47405 225.53 <.0001
sex_IDs -0.32929 0.01355 252.63250 590.59 <.0001
;
data Projects.source;
set Projects.source;
Where FSVV2 < 351.5724;
NCD17f4=
NCD17f1 * 0.01066
+ NCD17f2 * 5.76168
+ NCD17f3 * 0.11820
- PAMETs17ms * 0.14377
+ AmbientPM17ms * 0.19499
- sex_IDs * 0.32929
;
run;
proc corr data=Projects.source fisher;
Where FSVV2 < 351.5724;
var NCD17f1 NCD17f2 NCD17f3 NCD17f4 PAMETs17ms AmbientPM17ms sex_ids;
with NCD17ms;
RUN; quit;
*AT THIS POINT, THE LIBREF "PRODUCTS" BECOMES UNASSIGNED;
data Projects.source;
set Projects.source;
Where FSVV2 < 351.5724;
NCD17f5=
- pmeat17KCs * 2.07116E-06
- rmeat17KCs * 9.55891E-05
- fish17KCs * 1.39819E-05
+ milk17KCs * 7.68185E-05
- poultry16KCs * 0.000357222
- eggs16KCs * 0.00032665
- aSFA16KCs * 0.000525174
- aPUFA17KCs * 0.000338451
- aTFA17KCs * 1.53108E-11
+ Alcohol17KCs * 0.00185041
+ Sugarb17KCs * 0.000974559
- potatoes16KCs * 8.61069E-05
- corn16KCs * 2.28338E-05
- fruits17KCs * 0.000803833
- Vegetables17KCs * 0.000171004
- nutsseeds17KCs * 1.79191E-05
- wgrains17KCs * 0.000164865
+ legumes17KCs * 0.000382809
- rice16KCs * 0.000311896
- swtpot16KCs * 0.000384817
- PAMETs17m * 0.14678
+ AmbientPM17m * 0.31418
+ smoke17m * 0.30116
+ SLTobacco17m * 0.01873
+ HHairPoll17m * 0.08264
+ T1DM17m * 0.53065
+ T2DM17m * 0.08949
- sex_id * 0.22966
;
run; quit;
proc corr data=Products.source fisher;
Where FSVV2 < 351.5724;
var NCD17f1 NCD17f2 NCD17f3 NCD17f4 NCD17f5 PAMETs17ms AmbientPM17ms sex_ids;
with NCD17ms;
run; quit;
SAS Log
Errors (1)
ERROR: Libref PRODUCTS is not assigned.
Warnings (1)
Notes (2)
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 proc corr data=Products.source fisher;
ERROR: Libref PRODUCTS is not assigned.
70 Where FSVV2 < 351.5724;
WARNING: No data sets qualify for WHERE processing.
71 var NCD17f1 NCD17f2 NCD17f3 NCD17f4 NCD17f5 PAMETs17ms AmbientPM17ms sex_ids;
72 with NCD17ms;
73 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 409.68k
OS Memory 36016.00k
Timestamp 08/31/2021 02:00:00 AM
Step Count 366 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
73 ! quit;
74
75 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
85
Thanks for your help.proc corr data=Projects.source fisher;
Isn't that a typo for Projects, not Products?
proc corr data=Projects.source fisher;
Isn't that a typo for Projects, not Products?
Caution: Habitual use of the same data set as source and output data set as in
data Projects.source;
set Projects.source;
has potential to corrupt your data set and require rebuilding from scratch if you make a logic error as that use completely replaces the source data set.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.