<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error 78-322 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779455#M248240</link>
    <description>&lt;P&gt;The error in your code is before &lt;FONT face="courier new,courier"&gt;PROC SQL;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 22:17:08 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-11-09T22:17:08Z</dc:date>
    <item>
      <title>Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779451#M248239</link>
      <description>&lt;P&gt;Hello all. I am getting the above mentioned Error and I am not sure why. I have read quite a few answers to others with this error but they weren't comparable to mine. The query is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC SQL;
CREATE TABLE work.patient_cohort_w_Race AS
SELECT DISTINCT pc.*

	,CASE WHEN PatientRaceDSC = 'ASIAN' THEN 'Asian'
		  WHEN PatientRaceDSC = 'BLACK OR AFRICAN AMERICAN' THEN 'Black or African American'
		  WHEN PatientRaceDSC = 'Hispanic or Latino' THEN 'Hispanic or Latino'
		  WHEN PatientRaceDSC LIKE ('WHITE%') THEN 'White or Caucasian'
		  WHEN PatientRaceDSC = 'American Indian or Alaska Native' THEN 'American Indian or Alaska Native'
		  WHEN PatientRaceDSC = 'Native Hawaiian or Other Pacific Islander' THEN 'Native Hawaiian or Other Pacific Islander'
	 	  WHEN PatientRaceDSC IN ('Declined', 'Unavailable') THEN 'Unknown'
		  WHEN PatientRaceDSC IS NULL THEN 'Unknown'
		  ELSE 'Other' END AS RACE
	, CASE WHEN EthnicGroupDSC in ('Yes Hispanic','Hispanic') THEN 'YES' 
	      ELSE 'NO' END AS HISPANIC_LATINO

FROM Fin.HospitalAccount HA 	
LEFT JOIN work.patient_cohort pc on HA.PatientID = pc.PatientID
LEFT JOIN pat.Race R on HA.PatientID = R.PatientID
LEFT JOIN pat.Patient P on HA.PatientID = P.PatientID&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and this is the log with the error:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;274  PROC SQL;
     ----
     78
ERROR 78-322: Expecting a ','.

275  CREATE TABLE work.patient_cohort_w_Race AS
276  SELECT DISTINCT pc.*
277
278      ,CASE WHEN PatientRaceDSC = 'ASIAN' THEN 'Asian'
279            WHEN PatientRaceDSC = 'BLACK OR AFRICAN AMERICAN' THEN 'Black or African American'
280            WHEN PatientRaceDSC = 'Hispanic or Latino' THEN 'Hispanic or Latino'
281            WHEN PatientRaceDSC LIKE ('WHITE%') THEN 'White or Caucasian'
282            WHEN PatientRaceDSC = 'American Indian or Alaska Native' THEN 'American Indian or
282! Alaska Native'
283            WHEN PatientRaceDSC = 'Native Hawaiian or Other Pacific Islander' THEN 'Native
283! Hawaiian or Other Pacific Islander'
284            WHEN PatientRaceDSC IN ('Declined', 'Unavailable') THEN 'Unknown'
285            WHEN PatientRaceDSC IS NULL THEN 'Unknown'
286            ELSE 'Other' END AS RACE
287      , CASE WHEN EthnicGroupDSC in ('Yes Hispanic','Hispanic') THEN 'YES'
288            ELSE 'NO' END AS HISPANIC_LATINO
289
290  FROM Fin.HospitalAccount HA
291  LEFT JOIN work.patient_cohort pc on HA.PatientID = pc.PatientID
292  LEFT JOIN pat.Race R on HA.PatientID = R.PatientID
293  LEFT JOIN pat.Patient P on HA.PatientID = P.PatientID&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:14:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779451#M248239</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-09T22:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779455#M248240</link>
      <description>&lt;P&gt;The error in your code is before &lt;FONT face="courier new,courier"&gt;PROC SQL;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 22:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779455#M248240</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-09T22:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779457#M248242</link>
      <description>Error is before this code. &lt;BR /&gt;If you cannot find it, restart your system to clear any left over bugs and run it all again and see if it errors out. If it does, post the code immediately before this as well.</description>
      <pubDate>Tue, 09 Nov 2021 22:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779457#M248242</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-09T22:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779467#M248250</link>
      <description>{lease disregard. I found my issue</description>
      <pubDate>Tue, 09 Nov 2021 23:17:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779467#M248250</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-09T23:17:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779489#M248258</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I sent the message to disregard my question because I figured it out and didn't know that you had already replied. The issue was that I didn't include 'quit;' to the end of the query. But now that creates another issue. I brought the code in from SQL and it runs. The&amp;nbsp;PatientRaceDSC and the&amp;nbsp;EthnicGroupDSC columns are created, however, they are not populating correctly. The rows in the&amp;nbsp;PatientRaceDSC are all populated with 'UNKNOWN' and all the rows in the&amp;nbsp;EthnicGroupDSC are all populated with 'NO' but that cant be so. I researched the CASE expression and it seems to be written correctly (I Think). I believe I have all the joins correct as well. Do you have any thoughts on what could be wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 02:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779489#M248258</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-10T02:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779490#M248259</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I discovered the issue, but that just created a new one. Please see the reply to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;. Any insight on this would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 02:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779490#M248259</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-10T02:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779492#M248261</link>
      <description>Please show the output from a PROC FREQ on the PatientRaceDSC column. You didn't prefix it so not sure what table it's from. &lt;BR /&gt;&lt;BR /&gt;Following may also be useful:&lt;BR /&gt;&lt;BR /&gt;proc freq data=patient_cohort_w_Race;&lt;BR /&gt;table PatientRaceDSC*Race / list missing;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 10 Nov 2021 02:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779492#M248261</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-10T02:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779498#M248263</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the results from the&amp;nbsp;proc freq data=patient_cohort_w_Race; you suggested&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;671  proc freq data=patient_cohort_w_Race;
672  table PatientRaceDSC*Race / list missing;
ERROR: Variable PATIENTRACEDSC not found.
673  run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Nov 2021 03:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779498#M248263</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-10T03:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779539#M248288</link>
      <description>&lt;P&gt;This means you do not have a variable name PATIENTRACEDSC in data set PATIENT_COHORT_W_RACE. If you disagree with this error message, then show us PROC CONTENTS for data set PATIENT_COHORT_W_RACE.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 11:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779539#M248288</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-10T11:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779572#M248309</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating the&amp;nbsp;&lt;SPAN&gt;PATIENT_COHORT_W_RACE table so it doesn't exist yet. I realized that I didnt have the aliases for the tables they variable does exist in and added them. I get the same results. Here is the code that creates the&amp;nbsp;work.patient_cohort table which works fine:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC SQL;
CREATE TABLE work.patient_cohort AS
SELECT DISTINCT a.mrn
	, a.PatientNM
	, a.dob
	, a.payorNM
	, scan(a.patientnm,1,',') as lastname
	, scan(a.patientnm, 2, ',') as firstname
	, a.SubscriberID as InsuredsIDNumber
	, a.firstDt as cohort_entering_Date
	, a.planID
	, a.PayorID
	,COMPRESS(SubscriberID, '', 'kd') AS EditedInsuredsIDNumber

FROM work.dataPull_2 a 
	INNER JOIN work.cntByMRN b
		ON a.mrn= b.mrn
	WHERE 
/*	 payornm like '%HARVARD PILGRIM%' /*' reporting period*/
	 payorID = 110001
/*and *PayorID IN (170001);*TUFTS HEALTH PLAN*/

;QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;Now I want to add the Race and the Ethnicity variable by creating the&amp;nbsp;&lt;CODE class=""&gt;work.patient_cohort_w_Race table:&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC SQL;
CREATE TABLE work.patient_cohort_w_Race AS
SELECT DISTINCT pc.*

	,CASE WHEN r.PatientRaceDSC  = 'ASIAN' THEN 'Asian'
		  WHEN r.PatientRaceDSC = 'BLACK OR AFRICAN AMERICAN' THEN 'Black or African American'
		  WHEN r.PatientRaceDSC = 'Hispanic or Latino' THEN 'Hispanic or Latino'
		  WHEN r.PatientRaceDSC LIKE ('WHITE%') THEN 'White or Caucasian'
		  WHEN r.PatientRaceDSC = 'American Indian or Alaska Native' THEN 'American Indian or Alaska Native'
		  WHEN r.PatientRaceDSC = 'Native Hawaiian or Other Pacific Islander' THEN 'Native Hawaiian or Other Pacific Islander'
	 	  WHEN r.PatientRaceDSC IN ('Declined', 'Unavailable') THEN 'Unknown'
		  WHEN r.PatientRaceDSC IS NULL THEN 'Unknown'
		  ELSE 'Other' END AS RACE
	, CASE WHEN p.EthnicGroupDSC in ('Yes Hispanic','Hispanic') THEN 'YES' 
	      ELSE 'NO' END AS HISPANIC_LATINO

FROM work.patient_cohort pc	
LEFT JOIN pat.Identity I on pc.MRN = I.PatientIdentityID
LEFT JOIN pat.Race R on I.PatientIdentityID = R.PatientID
LEFT JOIN pat.Patient P on I.PatientIdentityID = P.PatientID
;quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 14:47:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779572#M248309</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-10T14:47:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779574#M248311</link>
      <description>&lt;P&gt;I specifically asked to see the PROC CONTENTS output for data set PATIENT_COHOR_W_RACE. Please show us that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, when debugging code like this, show us the LOG, not the code. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 14:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779574#M248311</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-10T14:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779576#M248312</link>
      <description>&lt;P&gt;You seem to be having a hard time describing your issue.&lt;/P&gt;
&lt;P&gt;Do you mean that in one or more of your generated datasets that some of the variables are getting set to UNKNOWN for every observation?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If so you need to look at the values that the variables you used in the calculations had.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could start with doing a PROC FREQ on the input datasets for the variables used in the calculation.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;proc freq data=pat.Race;
  tables PatientRaceDSC  / list missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you might not see the problem there as it might be the issue is in the joining.&amp;nbsp; You can check that better by including the input variables into the output dataset.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;CREATE TABLE work.patient_cohort_w_Race AS
SELECT DISTINCT pc.*,r.PatientRaceDSC  
....&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can check the values actually used in the calculations.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 15:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779576#M248312</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-11-10T15:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779597#M248322</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
CREATE TABLE work.patient_cohort_w_Race AS
SELECT DISTINCT pc.*,
r.PatientRaceDSC,

	,CASE WHEN r.PatientRaceDSC  = 'ASIAN' THEN 'Asian'
		  WHEN r.PatientRaceDSC = 'BLACK OR AFRICAN AMERICAN' THEN 'Black or African American'
		  WHEN r.PatientRaceDSC = 'Hispanic or Latino' THEN 'Hispanic or Latino'
		  WHEN r.PatientRaceDSC LIKE ('WHITE%') THEN 'White or Caucasian'
		  WHEN r.PatientRaceDSC = 'American Indian or Alaska Native' THEN 'American Indian or Alaska Native'
		  WHEN r.PatientRaceDSC = 'Native Hawaiian or Other Pacific Islander' THEN 'Native Hawaiian or Other Pacific Islander'
	 	  WHEN r.PatientRaceDSC IN ('Declined', 'Unavailable') THEN 'Unknown'
		  WHEN r.PatientRaceDSC IS NULL THEN 'Unknown'
		  ELSE 'Other' END AS RACE
	, CASE WHEN p.EthnicGroupDSC in ('Yes Hispanic','Hispanic') THEN 'YES' 
	      ELSE 'NO' END AS HISPANIC_LATINO

FROM work.patient_cohort pc	
LEFT JOIN pat.Identity I on pc.MRN = I.PatientIdentityID
LEFT JOIN pat.Race R on I.PatientIdentityID = R.PatientID
LEFT JOIN pat.Patient P on I.PatientIdentityID = P.PatientID
;quit;

proc freq data=patient_cohort_w_Race ;
table PatientRaceDSC*Race / list missing;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Post the results from the result tab and the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 16:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779597#M248322</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-11-10T16:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error 78-322</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779651#M248356</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to figure it out and everything ran fine. Thanks for your heads ups and suggestions.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Nov 2021 20:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-78-322/m-p/779651#M248356</guid>
      <dc:creator>wheddingsjr</dc:creator>
      <dc:date>2021-11-10T20:47:23Z</dc:date>
    </item>
  </channel>
</rss>

