<?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: Invalid Numeric data Q in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757877#M239255</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yr=19;
data dad&amp;amp;yr.;
set dss.Dad_dss_core_20&amp;amp;yr.;

format AGE_GRP $20.;
format PROVINCE $20.;

if ANALYTICAL_INST_TYPE_CODE in ('1', 'A') ;


	/* general inclusion/exclusion */
	if UPCASE(ENTRY_CODE) = "S" or "N" then delete; 
	if UPCASE(ADMISSION_CATEGORY) = "R" then delete; 

/* Province Groupings */
	if strip(submitting_prov_code) ne ('4') ;
	if strip(SUBMITTING_PROV_CODE) in ( "0" "1" "2" "3" )then PROVINCE = "Atlantic";
	else if strip(SUBMITTING_PROV_CODE) in ("Y" "V" "N" "A" )then PROVINCE = "Territories";
	else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";

/*GENDER*/
if gender_code  in ("F" , "M") then gender_include=1;
if gender_include=1;

/**AGE**/
if UPCASE(age_code) in ("D" ) and AGE_UNITS &amp;gt;29 then age_include = 1;
if age_include = 1;
 
	
/* AGE GROUPS */
	if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;lt;30 then AGE_GRP = "Group 1: &amp;lt;30 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 30 &amp;lt;= AGE_UNITS &amp;lt;= 49 then AGE_GRP = "Group 2: 30-49 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 50 &amp;lt;= AGE_UNITS &amp;lt;= 64 then AGE_GRP = "Group 3: 50-64 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;gt;= 65 then AGE_GRP = "Group 4: &amp;gt;= 65 yrs.";
/*Acute IP*/
if ANALYTICAL_INST_TYPE_CODE in ("1") then inpatient = 1;
	if inpatient = 1;

	/**Diagnosis of interest HCV, CLD, or HCC **/

 array _diag_code (25)$ DIAG_CODE_: ;
 
 do i=1 to 25;
 IF SUBSTR(_diag_code{i},1,4) in : ('B182') or SUBSTR(_diag_code{i}, 1,3) in ('C22','K70', 'K71', 'K72', 'K73', 'K74', 'K75', 'K76', 'K77', 'R18')  then DIAG=1;
  
 end;

 if DIAG=1 ;

 array _cci_code (20)$ interv_cci_code_:;
 array _ooh (20)$ ooh_ind_:;
 array _status(20)$  status_attribute_code_:;

 do j=1 to 20;

 IF (_cci_code{j}) in :('1OA85LAXXK','1OA85VCXXK','1OA85WLXXJ', '1OA85WLXXK')
 and  _ooh[j] = ' ' and 
     _status[j] ne 'A'  then INTERV=1;
  
 end;

 if DIAG=1 and INTERV=1 THEN FLAG=1;

	/* DEATHS */
	if Discharge_disposition in ('07'  '72' '73' '74') then flag_InHospDeath = 1;

	
	%if &amp;amp;yr. &amp;lt;= 18 %then %do;if DISCHARGE_DISPOSITION  in ("07") then flag_InHospDeath = 1;%end;
	%if &amp;amp;yr. &amp;gt;= 18 %then %do;if DISCHARGE_DISPOSITION in ("72" "73" "74") then flag_InHospDeath = 1 ;%end;

	
	/**/


keep
fiscal_year
dad_transaction_id
SUBMITTING_PROV_CODE
province
ENTRY_CODE
ADMISSION_CATEGORY
ANALYTICAL_INST_TYPE_CODE
gender_code
age_code
age_units
age_include
gender_include
AGE_GRP
inpatient
DISCHARGE_DISPOSITION
DIAG_CODE_:
interv_cci_code_:
ooh_ind_:
status_attribute_code_:
FLAG
DIAG
INTERV
flag_InHospDeath

;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is likely wrong:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;if UPCASE(ENTRY_CODE) = "S" or "N" then delete; &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Separate&amp;nbsp;is&amp;nbsp;spelled&amp;nbsp;incorrectly&amp;nbsp;here:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the code from above and post that log. It will indicate exactly where the error is once the macro wrapping isn't involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385462"&gt;@Baba9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_dad(yr=);

data dad&amp;amp;yr.;
set dss.Dad_dss_core_20&amp;amp;yr.;

format AGE_GRP $20.;
format PROVINCE $20.;

if ANALYTICAL_INST_TYPE_CODE in ('1', 'A') ;


	/* general inclusion/exclusion */
	if UPCASE(ENTRY_CODE) = "S" or "N" then delete; 
	if UPCASE(ADMISSION_CATEGORY) = "R" then delete; 

/* Province Groupings */
	if strip(submitting_prov_code) ne ('4') ;
	if strip(SUBMITTING_PROV_CODE) in ( "0" "1" "2" "3" )then PROVINCE = "Atlantic";
	else if strip(SUBMITTING_PROV_CODE) in ("Y" "V" "N" "A" )then PROVINCE = "Territories";
	else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";

/*GENDER*/
if gender_code  in ("F" , "M") then gender_include=1;
if gender_include=1;

/**AGE**/
if UPCASE(age_code) in ("D" ) and AGE_UNITS &amp;gt;29 then age_include = 1;
if age_include = 1;
 
	
/* AGE GROUPS */
	if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;lt;30 then AGE_GRP = "Group 1: &amp;lt;30 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 30 &amp;lt;= AGE_UNITS &amp;lt;= 49 then AGE_GRP = "Group 2: 30-49 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 50 &amp;lt;= AGE_UNITS &amp;lt;= 64 then AGE_GRP = "Group 3: 50-64 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;gt;= 65 then AGE_GRP = "Group 4: &amp;gt;= 65 yrs.";
/*Acute IP*/
if ANALYTICAL_INST_TYPE_CODE in ("1") then inpatient = 1;
	if inpatient = 1;

	/**Diagnosis of interest HCV, CLD, or HCC **/

 array _diag_code (25)$ DIAG_CODE_: ;
 
 do i=1 to 25;
 IF SUBSTR(_diag_code{i},1,4) in : ('B182') or SUBSTR(_diag_code{i}, 1,3) in ('C22','K70', 'K71', 'K72', 'K73', 'K74', 'K75', 'K76', 'K77', 'R18')  then DIAG=1;
  
 end;

 if DIAG=1 ;

 array _cci_code (20)$ interv_cci_code_:;
 array _ooh (20)$ ooh_ind_:;
 array _status(20)$  status_attribute_code_:;

 do j=1 to 20;

 IF (_cci_code{j}) in :('1OA85LAXXK','1OA85VCXXK','1OA85WLXXJ', '1OA85WLXXK')
 and  _ooh[j] = ' ' and 
     _status[j] ne 'A'  then INTERV=1;
  
 end;

 if DIAG=1 and INTERV=1 THEN FLAG=1;

	/* DEATHS */
	if Discharge_disposition in ('07'  '72' '73' '74') then flag_InHospDeath = 1;

	
	%if &amp;amp;yr. &amp;lt;= 18 %then %do;if DISCHARGE_DISPOSITION  in ("07") then flag_InHospDeath = 1;%end;
	%if &amp;amp;yr. &amp;gt;= 18 %then %do;if DISCHARGE_DISPOSITION in ("72" "73" "74") then flag_InHospDeath = 1 ;%end;

	
	/**/


keep
fiscal_year
dad_transaction_id
SUBMITTING_PROV_CODE
province
ENTRY_CODE
ADMISSION_CATEGORY
ANALYTICAL_INST_TYPE_CODE
gender_code
age_code
age_units
age_include
gender_include
AGE_GRP
inpatient
DISCHARGE_DISPOSITION
DIAG_CODE_:
interv_cci_code_:
ooh_ind_:
status_attribute_code_:
FLAG
DIAG
INTERV
flag_InHospDeath

;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Jul 2021 18:44:40 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-07-28T18:44:40Z</dc:date>
    <item>
      <title>Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757855#M239244</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;435   %run_dad(yr=19);
MPRINT(RUN_DAD):   data dad19;
MPRINT(RUN_DAD):   set dss.Dad_dss_core_2019;
MPRINT(RUN_DAD):   format AGE_GRP $20.;
MPRINT(RUN_DAD):   format PROVINCE $20.;
MPRINT(RUN_DAD):   if ANALYTICAL_INST_TYPE_CODE in ('1', 'A') ;
MPRINT(RUN_DAD):   if UPCASE(ENTRY_CODE) = "S" or "N" then delete;
MPRINT(RUN_DAD):   if UPCASE(ADMISSION_CATEGORY) = "R" then delete;
MPRINT(RUN_DAD):   if strip(submitting_prov_code) ne ('4') ;
MPRINT(RUN_DAD):   if strip(SUBMITTING_PROV_CODE) in ( "0" "1" "2" "3" )then PROVINCE =
"Atlantic";
MPRINT(RUN_DAD):   else if strip(SUBMITTING_PROV_CODE) in ("Y" "V" "N" "A" )then PROVINCE =
"Territories";
MPRINT(RUN_DAD):   else if strip(SUBMITTING_PROV_CODE) in ("4" "5" "6" "7" "8" "9" ) then
PROVINCE = "Seperate";
MPRINT(RUN_DAD):   if gender_code in ("F" , "M") then gender_include=1;
MPRINT(RUN_DAD):   if gender_include=1;
MPRINT(RUN_DAD):   if UPCASE(age_code) in ("D" ) and AGE_UNITS &amp;gt;29 then age_include = 1;
MPRINT(RUN_DAD):   if age_include = 1;
MPRINT(RUN_DAD):   if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;lt;30 then AGE_GRP = "Group 1: &amp;lt;30
yrs.";
MPRINT(RUN_DAD):   else if UPCASE(age_code) in ("Y" "E")and 30 &amp;lt;= AGE_UNITS &amp;lt;= 49 then AGE_GRP =
"Group 2: 30-49 yrs.";
MPRINT(RUN_DAD):   else if UPCASE(age_code) in ("Y" "E")and 50 &amp;lt;= AGE_UNITS &amp;lt;= 64 then AGE_GRP =
"Group 3: 50-64 yrs.";
MPRINT(RUN_DAD):   else if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;gt;= 65 then AGE_GRP = "Group
4: &amp;gt;= 65 yrs.";
MPRINT(RUN_DAD):   if ANALYTICAL_INST_TYPE_CODE in ("1") then inpatient = 1;
MPRINT(RUN_DAD):   if inpatient = 1;
MPRINT(RUN_DAD):   array _diag_code (25)$ DIAG_CODE_: ;
MPRINT(RUN_DAD):   do i=1 to 25;
MPRINT(RUN_DAD):   IF SUBSTR(_diag_code{i},1,4) in : ('B182')or SUBSTR(_diag_code{i}, 1,3) in
('C22','K70', 'K71', 'K72', 'K73', 'K74', 'K75', 'K76', 'K77', 'R18') then DIAG=1;
MPRINT(RUN_DAD):   end;
MPRINT(RUN_DAD):   if DIAG=1 ;
MPRINT(RUN_DAD):   array _cci_code (20)$ interv_cci_code_:;
MPRINT(RUN_DAD):   array _ooh (20)$ ooh_ind_:;
MPRINT(RUN_DAD):   array _status(20)$ status_attribute_code_:;
MPRINT(RUN_DAD):   do j=1 to 20;
MPRINT(RUN_DAD):   IF (_cci_code{j}) in :('1OA85LAXXK','1OA85VCXXK','1OA85WLXXJ', '1OA85WLXXK')
and _ooh[j] = ' ' and _status[j] ne 'A' then INTERV=1;
MPRINT(RUN_DAD):   end;
MPRINT(RUN_DAD):   if DIAG=1 and INTERV=1 THEN FLAG=1;
MPRINT(RUN_DAD):   if Discharge_disposition in ('07' '72' '73' '74') then flag_InHospDeath = 1;
MPRINT(RUN_DAD):  if DISCHARGE_DISPOSITION in ("72" "73" "74") then flag_InHospDeath = 1 ;
MPRINT(RUN_DAD):   keep fiscal_year dad_transaction_id SUBMITTING_PROV_CODE province ENTRY_CODE
ADMISSION_CATEGORY ANALYTICAL_INST_TYPE_CODE gender_code age_code age_units age_include
gender_include AGE_GRP MAIN_PATIENT_SERVICE MAIN_PATIENT_SUBSERVICE inpatient
DISCHARGE_DISPOSITION DIAG_CODE_: interv_cci_code_: ooh_ind_: status_attribute_code_: FLAG DIAG
INTERV flag_InHospDeath MCC ;
MPRINT(RUN_DAD):   run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      622:177
NOTE: Invalid numeric data, 'N' , at line 622 column 177.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hello Would appreciate your advice in correcting the error above&lt;/P&gt;&lt;P&gt;Thankyou&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757855#M239244</guid>
      <dc:creator>Baba9</dc:creator>
      <dc:date>2021-07-28T18:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757858#M239246</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385462"&gt;@Baba9&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;Hello Would appreciate your advice in correcting the error above&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There are no errors in the log you posted. Please explain further.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757858#M239246</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-28T18:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757862#M239247</link>
      <description>1. You need to provide the code for the macro, since it's clearly conditionally running different things. &lt;BR /&gt;&lt;BR /&gt;And if you identify this line it can help you debug your code. &lt;BR /&gt;NOTE: Invalid numeric data, 'N' , at line 622 column 177.</description>
      <pubDate>Wed, 28 Jul 2021 18:16:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757862#M239247</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-28T18:16:18Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757863#M239248</link>
      <description>&lt;P&gt;The code for the macro is in the above code&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need help in resolving this NOTE&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid numeric data, 'N' , at line 622 column 177.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757863#M239248</guid>
      <dc:creator>Baba9</dc:creator>
      <dc:date>2021-07-28T18:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757866#M239251</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385462"&gt;@Baba9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The code for the macro is in the above code&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help in resolving this NOTE&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Invalid numeric data, 'N' , at line 622 column 177.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Okay, that's a NOTE, not an error. It may be that the exact correct thing was done (which of course is not an error).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to provide the macro used, and a portion of your data (please provide a portion of your data via &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt; and not via any other method)&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757866#M239251</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-28T18:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757869#M239252</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_dad(yr=);

data dad&amp;amp;yr.;
set dss.Dad_dss_core_20&amp;amp;yr.;

format AGE_GRP $20.;
format PROVINCE $20.;

if ANALYTICAL_INST_TYPE_CODE in ('1', 'A') ;


	/* general inclusion/exclusion */
	if UPCASE(ENTRY_CODE) = "S" or "N" then delete; 
	if UPCASE(ADMISSION_CATEGORY) = "R" then delete; 

/* Province Groupings */
	if strip(submitting_prov_code) ne ('4') ;
	if strip(SUBMITTING_PROV_CODE) in ( "0" "1" "2" "3" )then PROVINCE = "Atlantic";
	else if strip(SUBMITTING_PROV_CODE) in ("Y" "V" "N" "A" )then PROVINCE = "Territories";
	else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";

/*GENDER*/
if gender_code  in ("F" , "M") then gender_include=1;
if gender_include=1;

/**AGE**/
if UPCASE(age_code) in ("D" ) and AGE_UNITS &amp;gt;29 then age_include = 1;
if age_include = 1;
 
	
/* AGE GROUPS */
	if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;lt;30 then AGE_GRP = "Group 1: &amp;lt;30 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 30 &amp;lt;= AGE_UNITS &amp;lt;= 49 then AGE_GRP = "Group 2: 30-49 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 50 &amp;lt;= AGE_UNITS &amp;lt;= 64 then AGE_GRP = "Group 3: 50-64 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;gt;= 65 then AGE_GRP = "Group 4: &amp;gt;= 65 yrs.";
/*Acute IP*/
if ANALYTICAL_INST_TYPE_CODE in ("1") then inpatient = 1;
	if inpatient = 1;

	/**Diagnosis of interest HCV, CLD, or HCC **/

 array _diag_code (25)$ DIAG_CODE_: ;
 
 do i=1 to 25;
 IF SUBSTR(_diag_code{i},1,4) in : ('B182') or SUBSTR(_diag_code{i}, 1,3) in ('C22','K70', 'K71', 'K72', 'K73', 'K74', 'K75', 'K76', 'K77', 'R18')  then DIAG=1;
  
 end;

 if DIAG=1 ;

 array _cci_code (20)$ interv_cci_code_:;
 array _ooh (20)$ ooh_ind_:;
 array _status(20)$  status_attribute_code_:;

 do j=1 to 20;

 IF (_cci_code{j}) in :('1OA85LAXXK','1OA85VCXXK','1OA85WLXXJ', '1OA85WLXXK')
 and  _ooh[j] = ' ' and 
     _status[j] ne 'A'  then INTERV=1;
  
 end;

 if DIAG=1 and INTERV=1 THEN FLAG=1;

	/* DEATHS */
	if Discharge_disposition in ('07'  '72' '73' '74') then flag_InHospDeath = 1;

	
	%if &amp;amp;yr. &amp;lt;= 18 %then %do;if DISCHARGE_DISPOSITION  in ("07") then flag_InHospDeath = 1;%end;
	%if &amp;amp;yr. &amp;gt;= 18 %then %do;if DISCHARGE_DISPOSITION in ("72" "73" "74") then flag_InHospDeath = 1 ;%end;

	
	/**/


keep
fiscal_year
dad_transaction_id
SUBMITTING_PROV_CODE
province
ENTRY_CODE
ADMISSION_CATEGORY
ANALYTICAL_INST_TYPE_CODE
gender_code
age_code
age_units
age_include
gender_include
AGE_GRP
inpatient
DISCHARGE_DISPOSITION
DIAG_CODE_:
interv_cci_code_:
ooh_ind_:
status_attribute_code_:
FLAG
DIAG
INTERV
flag_InHospDeath

;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757869#M239252</guid>
      <dc:creator>Baba9</dc:creator>
      <dc:date>2021-07-28T18:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757874#M239253</link>
      <description>&lt;P&gt;Another thing you can do (and should do) by yourself is to copy the log, as text; and paste it into your SAS program editor. Then batch modify the text by replacing&amp;nbsp;&lt;FONT face="courier new,courier"&gt;MPRINT(RUN_DAD):&lt;/FONT&gt; with blanks. This gives you code that you should run, and then you can determine exactly which line is finding this unexpected &lt;FONT face="courier new,courier"&gt;'N'&lt;/FONT&gt;, and once you know which line is the problem you can then find the problem in your dataset.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:37:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757874#M239253</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-28T18:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757877#M239255</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let yr=19;
data dad&amp;amp;yr.;
set dss.Dad_dss_core_20&amp;amp;yr.;

format AGE_GRP $20.;
format PROVINCE $20.;

if ANALYTICAL_INST_TYPE_CODE in ('1', 'A') ;


	/* general inclusion/exclusion */
	if UPCASE(ENTRY_CODE) = "S" or "N" then delete; 
	if UPCASE(ADMISSION_CATEGORY) = "R" then delete; 

/* Province Groupings */
	if strip(submitting_prov_code) ne ('4') ;
	if strip(SUBMITTING_PROV_CODE) in ( "0" "1" "2" "3" )then PROVINCE = "Atlantic";
	else if strip(SUBMITTING_PROV_CODE) in ("Y" "V" "N" "A" )then PROVINCE = "Territories";
	else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";

/*GENDER*/
if gender_code  in ("F" , "M") then gender_include=1;
if gender_include=1;

/**AGE**/
if UPCASE(age_code) in ("D" ) and AGE_UNITS &amp;gt;29 then age_include = 1;
if age_include = 1;
 
	
/* AGE GROUPS */
	if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;lt;30 then AGE_GRP = "Group 1: &amp;lt;30 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 30 &amp;lt;= AGE_UNITS &amp;lt;= 49 then AGE_GRP = "Group 2: 30-49 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 50 &amp;lt;= AGE_UNITS &amp;lt;= 64 then AGE_GRP = "Group 3: 50-64 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;gt;= 65 then AGE_GRP = "Group 4: &amp;gt;= 65 yrs.";
/*Acute IP*/
if ANALYTICAL_INST_TYPE_CODE in ("1") then inpatient = 1;
	if inpatient = 1;

	/**Diagnosis of interest HCV, CLD, or HCC **/

 array _diag_code (25)$ DIAG_CODE_: ;
 
 do i=1 to 25;
 IF SUBSTR(_diag_code{i},1,4) in : ('B182') or SUBSTR(_diag_code{i}, 1,3) in ('C22','K70', 'K71', 'K72', 'K73', 'K74', 'K75', 'K76', 'K77', 'R18')  then DIAG=1;
  
 end;

 if DIAG=1 ;

 array _cci_code (20)$ interv_cci_code_:;
 array _ooh (20)$ ooh_ind_:;
 array _status(20)$  status_attribute_code_:;

 do j=1 to 20;

 IF (_cci_code{j}) in :('1OA85LAXXK','1OA85VCXXK','1OA85WLXXJ', '1OA85WLXXK')
 and  _ooh[j] = ' ' and 
     _status[j] ne 'A'  then INTERV=1;
  
 end;

 if DIAG=1 and INTERV=1 THEN FLAG=1;

	/* DEATHS */
	if Discharge_disposition in ('07'  '72' '73' '74') then flag_InHospDeath = 1;

	
	%if &amp;amp;yr. &amp;lt;= 18 %then %do;if DISCHARGE_DISPOSITION  in ("07") then flag_InHospDeath = 1;%end;
	%if &amp;amp;yr. &amp;gt;= 18 %then %do;if DISCHARGE_DISPOSITION in ("72" "73" "74") then flag_InHospDeath = 1 ;%end;

	
	/**/


keep
fiscal_year
dad_transaction_id
SUBMITTING_PROV_CODE
province
ENTRY_CODE
ADMISSION_CATEGORY
ANALYTICAL_INST_TYPE_CODE
gender_code
age_code
age_units
age_include
gender_include
AGE_GRP
inpatient
DISCHARGE_DISPOSITION
DIAG_CODE_:
interv_cci_code_:
ooh_ind_:
status_attribute_code_:
FLAG
DIAG
INTERV
flag_InHospDeath

;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is likely wrong:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;if UPCASE(ENTRY_CODE) = "S" or "N" then delete; &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Separate&amp;nbsp;is&amp;nbsp;spelled&amp;nbsp;incorrectly&amp;nbsp;here:&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the code from above and post that log. It will indicate exactly where the error is once the macro wrapping isn't involved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/385462"&gt;@Baba9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro run_dad(yr=);

data dad&amp;amp;yr.;
set dss.Dad_dss_core_20&amp;amp;yr.;

format AGE_GRP $20.;
format PROVINCE $20.;

if ANALYTICAL_INST_TYPE_CODE in ('1', 'A') ;


	/* general inclusion/exclusion */
	if UPCASE(ENTRY_CODE) = "S" or "N" then delete; 
	if UPCASE(ADMISSION_CATEGORY) = "R" then delete; 

/* Province Groupings */
	if strip(submitting_prov_code) ne ('4') ;
	if strip(SUBMITTING_PROV_CODE) in ( "0" "1" "2" "3" )then PROVINCE = "Atlantic";
	else if strip(SUBMITTING_PROV_CODE) in ("Y" "V" "N" "A" )then PROVINCE = "Territories";
	else if strip(SUBMITTING_PROV_CODE) in  ("4" "5" "6" "7" "8" "9" ) then PROVINCE = "Seperate";

/*GENDER*/
if gender_code  in ("F" , "M") then gender_include=1;
if gender_include=1;

/**AGE**/
if UPCASE(age_code) in ("D" ) and AGE_UNITS &amp;gt;29 then age_include = 1;
if age_include = 1;
 
	
/* AGE GROUPS */
	if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;lt;30 then AGE_GRP = "Group 1: &amp;lt;30 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 30 &amp;lt;= AGE_UNITS &amp;lt;= 49 then AGE_GRP = "Group 2: 30-49 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and 50 &amp;lt;= AGE_UNITS &amp;lt;= 64 then AGE_GRP = "Group 3: 50-64 yrs.";
	else if UPCASE(age_code) in ("Y" "E")and AGE_UNITS &amp;gt;= 65 then AGE_GRP = "Group 4: &amp;gt;= 65 yrs.";
/*Acute IP*/
if ANALYTICAL_INST_TYPE_CODE in ("1") then inpatient = 1;
	if inpatient = 1;

	/**Diagnosis of interest HCV, CLD, or HCC **/

 array _diag_code (25)$ DIAG_CODE_: ;
 
 do i=1 to 25;
 IF SUBSTR(_diag_code{i},1,4) in : ('B182') or SUBSTR(_diag_code{i}, 1,3) in ('C22','K70', 'K71', 'K72', 'K73', 'K74', 'K75', 'K76', 'K77', 'R18')  then DIAG=1;
  
 end;

 if DIAG=1 ;

 array _cci_code (20)$ interv_cci_code_:;
 array _ooh (20)$ ooh_ind_:;
 array _status(20)$  status_attribute_code_:;

 do j=1 to 20;

 IF (_cci_code{j}) in :('1OA85LAXXK','1OA85VCXXK','1OA85WLXXJ', '1OA85WLXXK')
 and  _ooh[j] = ' ' and 
     _status[j] ne 'A'  then INTERV=1;
  
 end;

 if DIAG=1 and INTERV=1 THEN FLAG=1;

	/* DEATHS */
	if Discharge_disposition in ('07'  '72' '73' '74') then flag_InHospDeath = 1;

	
	%if &amp;amp;yr. &amp;lt;= 18 %then %do;if DISCHARGE_DISPOSITION  in ("07") then flag_InHospDeath = 1;%end;
	%if &amp;amp;yr. &amp;gt;= 18 %then %do;if DISCHARGE_DISPOSITION in ("72" "73" "74") then flag_InHospDeath = 1 ;%end;

	
	/**/


keep
fiscal_year
dad_transaction_id
SUBMITTING_PROV_CODE
province
ENTRY_CODE
ADMISSION_CATEGORY
ANALYTICAL_INST_TYPE_CODE
gender_code
age_code
age_units
age_include
gender_include
AGE_GRP
inpatient
DISCHARGE_DISPOSITION
DIAG_CODE_:
interv_cci_code_:
ooh_ind_:
status_attribute_code_:
FLAG
DIAG
INTERV
flag_InHospDeath

;
run;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:44:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757877#M239255</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-28T18:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757880#M239257</link>
      <description>&lt;P&gt;Can you tell us the column definitions dsd.Dad_dss_core_20&amp;amp;yr?&amp;nbsp; Something like the below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jimbarbour_0-1627497967632.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62016i41B1C94983BA7F45/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jimbarbour_0-1627497967632.png" alt="jimbarbour_0-1627497967632.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757880#M239257</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-28T18:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757881#M239258</link>
      <description>&lt;P&gt;I would fix this code error first.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if UPCASE(ENTRY_CODE) = "S" or "N" then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What is the intent of that statement?&amp;nbsp; Did you mean to compare the value of ENTRY_CODE to the number 1 ?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or did you intend to test if it is either S or N?&lt;/P&gt;
&lt;P&gt;If so then use the IN operator.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if UPCASE(ENTRY_CODE) in ("S" "N") then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757881#M239258</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-28T18:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757884#M239259</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I would fix this code error first.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if UPCASE(ENTRY_CODE) = "S" or "N" then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, actually, I believe that is the "error" itself.&amp;nbsp; Since "N" follows an "or", SAS is going to try to evaluate "N" to find out if it is "true" or "false".&amp;nbsp; Presumably, SAS tries to cast the "N" as a number, finds the data invalid, and puts the two Notes in the log, i.e. that it had to convert alpha to numeric and that invalid numeric data was encountered which had a value of "N".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757884#M239259</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-28T18:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid Numeric data Q</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757887#M239260</link>
      <description>&lt;P&gt;Thankyou everyone&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 18:56:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-Numeric-data-Q/m-p/757887#M239260</guid>
      <dc:creator>Baba9</dc:creator>
      <dc:date>2021-07-28T18:56:20Z</dc:date>
    </item>
  </channel>
</rss>

