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

Hi all,

 

I am pretty new to SAS and have the following errors I can't seem to understand. Below is my code:


libname si "C:\Users\kxfarle\EmoryUE Dropbox\Emory Upper Extremity\TruvenOutputDropbox\TruvenDatabases\CTFiles"; libname md "C:\Users\kxfarle\EmoryUE Dropbox\Emory Upper Extremity\TruvenOutputDropbox\TruvenDatabases\CTFiles\CTDepOutput"; %macro allfiles (allpatients, comorbidities, complications, enrollment, readmit, dataout); Proc SQL; Create Table &DataOut as Select Distinct a.ENROLID, a.PROC1, a.rx, a.SVCDATE, a.AGE, a.SEX, a.PLANTYP, a.REGION, a.STDPLAC, b.cm_obese, b.CM_Renal, b.CM_Alc, b.cm_HLD, b.cm_smoking, b.cm_HTN, b.cm_CAD, b.cm_CHF, b.cm_Rheum, b.cm_DM, b.CM_Depression, b.CM_Anxiety, b.CM_ADHD, b.CM_LBP, b.CM_FibroMy, c.MI, c.Stroke, c.Pneumonia, c.PneumoniaDays, c.Sepsis, c.SepsisDays, c.DVT_PE, c.DVT_PEDays, c.Opioid_OD, c.Opioid_ODDays, c.PostOpPain, c.PostOpPainDays, c.EDVisit, c.EDVisitDays, c.EDVisitPain, c.EDVisitPainDays, c.WoundComplication, c.Infection, c.IandD, c.CRPS, c.Med_Nerve_Lesion, c.Hypertroph_scar, c.Dysesthesia, d.Enrollment1y_1y, d.Enrollment1y_3y, d.Enrollment6M_3M, d.Enrollment6m_1y, d.Enrollment6m_3y, e.readmit90, e.readmit30, From &allpatients as a Left join &comorbidities as b On a.ENROLID = b.ENROLID Left join &complications as c On a.ENROLID = c.ENROLID Left join &enrollment as d on a.ENROLID = d.ENROLID Left join &readmit as e on a.ENROLID = e.ENROLID; Quit; %Mend allfiles; %allfiles (si.cccombinedv1, md.CCcomorbidities, md.CCcomplications90, si.ccenrollmentok, md.CCreadmit, md.ccallpatients); %allfiles (si.mdcombinedv1, md.MDcomorbidities, md.MDcomplications90, si.mdenrollmentok, md.MDreadmit, md.mdallpatients);

Here's the error I keep getting:

1    libname si "C:\Users\kxfarle\EmoryUE Dropbox\Emory Upper
1  ! Extremity\TruvenOutputDropbox\TruvenDatabases\CTFiles";
NOTE: Libref SI was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\kxfarle\EmoryUE Dropbox\Emory Upper
      Extremity\TruvenOutputDropbox\TruvenDatabases\CTFiles
2    libname md "C:\Users\kxfarle\EmoryUE Dropbox\Emory Upper
2  ! Extremity\TruvenOutputDropbox\TruvenDatabases\CTFiles\CTDepOutput";
NOTE: Libref MD was successfully assigned as follows:
      Engine:        V9
      Physical Name: C:\Users\kxfarle\EmoryUE Dropbox\Emory Upper
      Extremity\TruvenOutputDropbox\TruvenDatabases\CTFiles\CTDepOutput
3
4    %macro allfiles (allpatients, comorbidities, complications, enrollment, readmit, dataout);
5    Proc SQL;
6        Create Table &DataOut as
7        Select Distinct
8            a.ENROLID,
9            a.PROC1,
10           a.rx,
11           a.SVCDATE,
12           a.AGE,
13           a.SEX,
14           a.PLANTYP,
15           a.REGION,
16           a.STDPLAC,
17           b.cm_obese,
18           b.CM_Renal,
19           b.CM_Alc,
20           b.cm_HLD,
21           b.cm_smoking,
22           b.cm_HTN,
23           b.cm_CAD,
24           b.cm_CHF,
25           b.cm_Rheum,
26           b.cm_DM,
27           b.CM_Depression,
28           b.CM_Anxiety,
29           b.CM_ADHD,
30           b.CM_LBP,
31           b.CM_FibroMy,
32           c.MI,
33           c.Stroke,
34           c.Pneumonia,
35           c.PneumoniaDays,
36           c.Sepsis,
37           c.SepsisDays,
38           c.DVT_PE,
39           c.DVT_PEDays,
40           c.Opioid_OD,
41           c.Opioid_ODDays,
42           c.PostOpPain,
43           c.PostOpPainDays,
44           c.EDVisit,
45           c.EDVisitDays,
46           c.EDVisitPain,
47           c.EDVisitPainDays,
48           c.WoundComplication,
49           c.Infection,
50           c.IandD,
51           c.CRPS,
52           c.Med_Nerve_Lesion,
53           c.Hypertroph_scar,
54           c.Dysesthesia,
55           d.Enrollment1y_1y,
56           d.Enrollment1y_3y,
57           d.Enrollment6M_3M,
58           d.Enrollment6m_1y,
59           d.Enrollment6m_3y,
60           e.readmit90,
61           e.readmit30,
62       From
63           &allpatients as a
64       Left join
65           &comorbidities as b
66       On
67           a.ENROLID = b.ENROLID
68       Left join
69           &complications as c
70       On
71           a.ENROLID = c.ENROLID
72       Left join
73           &enrollment as d
74       on
75           a.ENROLID = d.ENROLID
76       Left join
77           &readmit as e
78       on
79           a.ENROLID = e.ENROLID;
80   Quit;
81   %Mend allfiles;
82   %allfiles (si.cccombinedv1, md.CCcomorbidities, md.CCcomplications90, si.ccenrollmentok,
82 ! md.CCreadmit, md.ccallpatients);
NOTE: Line generated by the macro variable "ALLPATIENTS".
1             si.cccombinedv1
              --
              1
                -
                22
                76
WARNING 1-322: Assuming the symbol IS was misspelled as si.

ERROR 22-322: Syntax error, expecting one of the following: MISSING, NOT, NULL, ^, ~.

ERROR 76-322: Syntax error, statement will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

83   %allfiles (si.mdcombinedv1, md.MDcomorbidities, md.MDcomplications90, si.mdenrollmentok,
83 ! md.MDreadmit, md.mdallpatients);


NOTE: Line generated by the macro variable "ALLPATIENTS".
1             si.mdcombinedv1
              --
              1
                -
                22
                76
WARNING 1-322: Assuming the symbol IS was misspelled as si.

ERROR 22-322: Syntax error, expecting one of the following: MISSING, NOT, NULL, ^, ~.

ERROR 76-322: Syntax error, statement will be ignored.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

Can anyone help me, please? 

1 ACCEPTED SOLUTION
2 REPLIES 2
johnthurtjr
Calcite | Level 5

Thank you! This was the exact solution. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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