***polypharmacy****************************************** ;
polyP=.;
if polyphrm=0 then polyP =1 ;
else if polyphrm=1 then polyP =2 ;
else if polyphrm=2 then polyP =2 ;
else if polyphrm=3 then polyP =3 ;
else if polyphrm=4 then polyP =3 ;
RUN ;
***SDS*************************************;
SDS=.;
SDS=SDS1-SDS2+SDS3+SDS4-SDS5-SDS6+SDS7+SDS8+SDS9+SDS10-SDS11-SDS12+SDS13-SDS14+SDS15-SDS16-SDS17-SDS18+SDS19-SDS20;
RUN ;
***STAI**************************************;
STAI=.;
STAI=0-Dep1+Dep2+Dep3+Dep4+Dep5-Dep6-Dep7+Dep8+Dep9-Dep10+Dep11+Dep12-Dep13+Dep14+Dep15-Dep16+Dep17+Dep18-Dep19+Dep20;
RUN ;
I would like to send all program. Could you coment to it??
Filename data1 "
C:\Users\Chris T\Documents\【 ★Researches】\【 ★論文研究】\(荒木先生)ポリファーマシーと不安\研究データ\【★★20180612 美杉四日市修正_カラムC修正】三重県東京都住民医師合体データ ver18(ポリファーマシー説明削除).csv " ;
data all;
infile data1 DLM=',' DSD MISSOVER;
Input Sex Age Polyphrm PCS MCS
Dep1 Dep2 Dep3 Dep4 Dep5 Dep6 Dep7 Dep8 Dep9 Dep10 Dep11 Dep12 Dep13 Dep14 Dep15 Dep16 Dep17 Dep18 Dep19 Dep20
smile1wk smilesM cry1wk crysM
SDS1 SDS2 SDS3 SDS4 SDS5 SDS6 SDS7 SDS8 SDS9 SDS10 SDS11 SDS12 SDS13 SDS14 SDS15 SDS16 SDS17 SDS18 SDS19 SDS20;
************************************************;
*definition ;
************************************************;
****cAge******************************;
cAge=.;
if 0 < age<65 then cAge=0;
else if age>=65 then cAge =1;
RUN ;
***polypharmacy****************************************** ;
polyP=.;
if polyphrm=0 then polyP =1 ;
else if polyphrm=1 then polyP =2 ;
else if polyphrm=2 then polyP =2 ;
else if polyphrm=3 then polyP =3 ;
else if polyphrm=4 then polyP =3 ;
RUN ;
***SDS*************************************;
SDS=.;
SDS=SDS1-SDS2+SDS3+SDS4-SDS5-SDS6+SDS7+SDS8+SDS9+SDS10-SDS11-SDS12+SDS13-SDS14+SDS15-SDS16-SDS17-SDS18+SDS19-SDS20;
RUN ;
***STAI**************************************;
STAI=.;
STAI=0-Dep1+Dep2+Dep3+Dep4+Dep5-Dep6-Dep7+Dep8+Dep9-Dep10+Dep11+Dep12-Dep13+Dep14+Dep15-Dep16+Dep17+Dep18-Dep19+Dep20;
RUN ;
******************************************;
******************************************;
*analyses ;
******************************************;
******************************************;
*******************************;
*******************************;
**** characteristics ;
*******************************;
*******************************;
**********************;
***characteristics(all)****;
***********************;
title ‘CHARACTERISTICS (ALL)’;
proc freq; tables (PolyP Sex polyphrm); run;
proc univariate; var age PCS SDS STAI; run;
***************************************************;
***characteristics (subjects selected for analysis)***;
****************************************************;
title ‘CHARACTERISTICS (dermatography)’;
proc sort;
by PolyP; run;
proc freq; tables Sex* PolyP/CHISQ; run;
proc univariate; var age PCS SDS STAI;
by PolyP;
run;
*******************************;
*******************************;
**** relationship ;
*******************************;
*******************************;
************************;
******ポリファーマシー***********;
************************;
******polypharmacyとの単関連***********;
title1 ‘polypharmacyとの単関連’;
proc anova;
class PolyP;
model STAI = PolyP;
means PolyP/scheffe; run;
proc anova;
class PolyP;
model SDS = PolyP;
means PolyP/scheffe; run;
******polypharmacyとの重関連***********;
title1 ‘polypharmacyとの重関連’;
proc GLM;
class PolyP PCS Age sex;
model SDS = PolyP PCS Age sex;
means PolyP;
run;
proc GLM;
class PolyP PCS Age sex;
model STAI = PolyP PCS Age sex;
means PolyP;
run;
This part of the program makes NO sense.
RUN ;
***polypharmacy****************************************** ;
polyP=.;
The RUN statement ends the definition of the data step.
The comment statement is fine in between steps.
But you cannot have an assignment statement that is NOT part of a data step.
Remove the extra RUN; statements from the middle of the DATA step.
Just leave the final one.
RUN ;
******************************************;
******************************************;
*analyses ;
******************************************;
******************************************;
ONE RUN: per data step and most procedures. The first Run would end a data step so in what you show everything after the first Run; would throw errors.
Some values and what you expect for a result might be nice.
When any variable has a missing value when doing a+b+c SAS will return missing. So if you want to have sum result if one or more variables is missing you may want to use the SUM function which returns the sum of the values present. IF this is the case then you may instead of
SDS=SDS1-SDS2+SDS3+SDS4-SDS5-SDS6+SDS7+SDS8+SDS9+SDS10-SDS11-SDS12+SDS13-SDS14+SDS15-SDS16-SDS17-SDS18+SDS19-SDS20;
you might want
sds = sum(SDS1,SDS3,SDS4,SDS7,SDS8,SDS9,SDS10,SDS13,SDS15,SDS19) -sum(SDS2,SDS5,SDS6,SDS11,SDS12,SDS14,SDS16,SDS17,SDS18,SDS20);
and similar for those other long combinations of + and -.
I am very sorry to be late to response.
Yes, when I rewrite the statement as below, the analysis works.
However, the analyasis stop with the statement as below.
105 proc anova;
106 class PolyP;
107 model SDS = PolyP;
108 means PolyP/scheffe; run;
ERROR: One or more variables are missing or freq or weight is zero on every observation.
114 proc GLM;
115 class PolyP PCS Age sex;
116 model SDS = PolyP PCS Age sex;
117 means PolyP;
118
119
ERROR: One or more variables are missing or freq or weight is zero on every observation.
Could you indicate my mistake??
with best regards,
Yousuke
PS
By the way, the procedure as below works regarding STAI.
100 proc anova;
WARNING: ANOVAを含むSAS/STATプロダクトの使用期限日が近づいているため、失効を知らせる警告モードに切り替わっています。
PROC SETINITを実行し、警告期間の詳細情報を確認してください。
101 class PolyP;
102 model STAI = PolyP;
103 means PolyP/scheffe;
104
WARNING: 5000点を超えるODS graphicsは表示されません。
PROC ANOVAステートメントのPLOTS(MAXPOINTS=)オプションを使用してカットオフを変更または上書きしてください。
NOTE: PROCEDURE ANOVA処理(合計処理時間):
処理時間 0.45 秒
CPU時間 0.21 秒
120 proc GLM;
121 class PolyP PCS Age sex;
122 model STAI = PolyP PCS Age sex;
123 means PolyP;
124 run;
NOTE: Means from the MEANS statement are not adjusted for other terms in the model. For adjusted means, use the LSMEANS
statement.
Considering your additional post saying that it works when the targe variable is "STAI", the target variable "SDS" might have missing value as the error message says.
You can find observations with missing value by:
data tmp; set <your table name>; where SDS=.; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!