I am running a piece of code and I keep getting this message in the log:
NOTE: Invalid data for X in line 1 98-98.
NOTE: Invalid data for Y in line 1 103-103.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9--
1 104995226899| |201601|38| |0|0|0|0|1045163266 | |23|19540822|18000101|
93 |H | |A| | | | | | | | | |N|N|N|Y|N|N|N|Y|N|N|N|N|N|Y|N|N| | | | |N| | | |6.59|6.59| |0|
185 455701400 | |0| | | |76|737|61|RP | | 233
I have tried switching the variables from character to numeric and back but I still get this message. Any ideas?
Thanks.
Hi @marleeakerson Can you please post your 1.code 2. Log 3. A couple of lines of data that you are reading?
Please post anything from the LOG into a code box opened on the forum using the </> icon that appears at the top of the message box.
The main message windows will reformat text so that the information is less useful.
Example is that invalid message you posted. The columns should align under the ruler:
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9--
The 1 on that line should be position 10, the 2 is 20 and so on. The number at the beginning of line is the starting position of the data. So the 93 means that the first character would be the 93rd character in along line. But the message window as removed some blank characters and may have made other replacements.
NOTE: Invalid data for EDW_Member_Sub_Program_Code in line 1 98-98. NOTE: Invalid data for FPL_Range_Code in line 1 103-103. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9-- 1 104995226899| |201601|38| |0|0|0|0|1045163266 | |23|19540822|18000101| 93 |H | |A| | | | | | | | | |N|N|N|Y|N|N|N|Y|N|N|N|N|N|Y|N|N| | | | |N| | | |6.59|6.59| |0| 185 455701400 | |0| | | |76|737|61|RP | | 233 Recipient_ID=104995226899 Recipient_ID_Inactive=. Valuation_Period_YYYYMM=201601 Aid_Group=38 Alien_Type_Code=. Amt_Annual_Income=0 Amt_FPL_Annual_Income=0 Amt_FPL_Monthly_Income=0 Amt_Monthly_Income=0 Case_Numb=1045163266 Case_Seq_Numb=. Continuous_Month_Enrolled=23 Date_Birth_Recipient=19540822 Date_Valuation=18000101 Dual_Elig_Aid_Catgy= EDW_Member_Sub_Program_Code=. Family_Size=. FPL_Range_Code=. Frail_Confirm_Code=. Fund_Code_MARS=. Immigration_Status= I_Budget= I_BuyinA= I_BuyinB= I_Casualty_Case= I_Continuous_Enrollment= I_Credible_TPL= I_DOC=N I_Dual_Aid=N I_Emergency_Services_Only=N I_FPL_ICES=Y I_Frail=N I_Initial_Enrollment=N I_Low_Income_Caretaker=N I_Managed_Care=Y I_Medicare=N I_Medicare_PartA=N I_Medicare_PartB=N I_Medicare_PartD=N I_Native_American=N I_Newly_Elig=Y I_Plan_ID_Changed=N I_PMP_Change=N I_Pre_12Month_Elig= I_Refugee= I_Re_Enrollment= I_Spenddown= I_TMA=N I_TPL_Coverage= Level_of_Care=. Level_of_Care_Type= Percent_FPL_Annual=6.59 Percent_FPL_Monthly=6.59 PGM_1915i_Code=. Percent_Pre_12Month_Elig=0 Plan_Provider_ID=455701400 Primary_Care_Physician= PCP_Location_ID=0 MMIS_Public_Health_PGM_Code= MMIS_Public_Health_PGM_Code2= EDW_Public_Health_PGM_Code= Recipient_Addr_County=76 Recipient_Age_In_Months=737 Recipient_Age_In_Years=61 Recipient_Aid_Catgy=RP Recipient_Aid_Catgy2= TANF_Cash_Code=. _ERROR_=1 _N_=1
This is the log above. This is the code below. Thank you.
libname output "S:\Project\IN_SUD_Demonstration\01.05831.010\14_Data\FSSA\Enrollment data\Output";
options obs=max compress=yes;
/*GRID: ENABLE GRID*/
%LET RC=%SYSFUNC(GRDSVC_ENABLE(_ALL_, SERVER=SASApp));
/*GRID STATEMENTS: SIGN ON TO REMOTE SESSION FOR A TASK*/
SIGNON TASK1;
%MACRO ASSIGN_LIBREF ;
%LET RC = 0;
data _null_ ;
set sashelp.vslib (where=(libname="RLIB")) ;
call symput('RC',1) ;
run ;
%IF &RC ne 1 %THEN %DO ;
libname RLIB server=task1 slibref=work;
%END ;
%MEND ;
%ASSIGN_LIBREF;
/* libname rlib server=task1 slibref=work;*/
/*START REMOTE SUBMISSION FOR A TASK*/
RSUBMIT TASK1
CONNECTWAIT=NO /*RUN TASKS ASYNCHRONOUSLY*/
CONNECTPERSIST=YES /*TASKS END (I.E., SIGN OFF) WHEN COMPLETE*/;
options compress=yes;
libname output "folder";
options obs=max compress=yes;
%put TASK1;
proc printto log="file";
run;
DATA output.file;
length fname $200;
INFILE "file"
DLM="|" DSD LRECL=3200 firstobs=1 filename=fname;
input
Recipient_ID
Recipient_ID_Inactive
Valuation_Period_YYYYMM
Aid_Group
Alien_Type_Code
Amt_Annual_Income
Amt_FPL_Annual_Income
Amt_FPL_Monthly_Income
Amt_Monthly_Income
Case_Numb
Case_Seq_Numb
Continuous_Month_Enrolled
Date_Birth_Recipient
Date_Valuation
Dual_Elig_Aid_Catgy $
EDW_Member_Sub_Program_Code
Family_Size
FPL_Range_Code
Frail_Confirm_Code
Fund_Code_MARS
Immigration_Status $
I_Budget $
I_BuyinA $
I_BuyinB $
I_Casualty_Case $
I_Continuous_Enrollment $
I_Credible_TPL $
I_DOC $
I_Dual_Aid $
I_Emergency_Services_Only $
I_FPL_ICES $
I_Frail $
I_Initial_Enrollment $
I_Low_Income_Caretaker $
I_Managed_Care $
I_Medicare $
I_Medicare_PartA $
I_Medicare_PartB $
I_Medicare_PartD $
I_Native_American $
I_Newly_Elig $
I_Plan_ID_Changed $
I_PMP_Change $
I_Pre_12Month_Elig $
I_Refugee $
I_Re_Enrollment $
I_Spenddown $
I_TMA $
I_TPL_Coverage $
Level_of_Care
Level_of_Care_Type $
Percent_FPL_Annual
Percent_FPL_Monthly
PGM_1915i_Code
Percent_Pre_12Month_Elig
Plan_Provider_ID
Primary_Care_Physician $
PCP_Location_ID
MMIS_Public_Health_PGM_Code $
MMIS_Public_Health_PGM_Code2 $
EDW_Public_Health_PGM_Code $
Recipient_Addr_County
Recipient_Age_In_Months
Recipient_Age_In_Years
Recipient_Aid_Catgy $
Recipient_Aid_Catgy2 $
TANF_Cash_Code
;
call symputx("filenm",fname);
run;
proc sql;
select memname into :lastds trimmed from sashelp.vtable as a
where libname="OUTPUT" order by a.crdate desc;
quit;
%put &filenm. ;
%put &lastds.;
ods select nlevels;
Proc freq data = output.file;
Run;
DAta _filename(keep=TEXT_FILE_NAME memname nobs);
length TEXT_FILE_NAME $200;
SET sashelp.vtable;
where libname="OUTPUT" and memname = "&lastds." ;
TEXT_FILE_NAME="&filenm.";
run;
proc append base=output.Enroll_file_ROWCT data=_filename force nowarn;
run;
proc printto;
run;
endrsubmit;
WAITFOR _ALL_ TASK1;
ods select nlevels;
Proc freq data = output.file;
Run;
DAta _filename(keep=TEXT_FILE_NAME memname nobs);
length TEXT_FILE_NAME $200;
SET sashelp.vtable;
where libname="OUTPUT" and memname = "&lastds." ;
TEXT_FILE_NAME="&filenm.";
run;
proc append base=output.Enroll_file_ROWCT data=_filename force nowarn;
run;
proc printto;
run;
endrsubmit;
WAITFOR _ALL_ TASK1;
This
NOTE: Invalid data for EDW_Member_Sub_Program_Code in line 1 98-98. NOTE: Invalid data for FPL_Range_Code in line 1 103-103.
These variables on your INPUT statement are reading numeric values.
And from this
93 |H | |A| | | | | | | | | |N|N|N|Y|N|N|N|Y|N|N|N|N|N|Y|N|N| | | | |N| | | |6.59|6.59| |0|
EDW_Member_sub_program_code is attempting to read the H, and the FPL_Range_Code is attempting to read the A as numeric.
Generally most things that are "codes", as in you aren't going to do arithmetic with them, should be character.
So I re ran the program with those variables as character, and I still got the same error message. Any other ideas?
NOTE: Invalid data for EDW_Member_Sub_Program_Code in line 1 98-98. NOTE: Invalid data for FPL_Range_Code in line 1 103-103. RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9-- 1 104995226899| |201601|38| |0|0|0|0|1045163266 | |23|19540822|18000101| 93 |H | |A| | | | | | | | | |N|N|N|Y|N|N|N|Y|N|N|N|N|N|Y|N|N| | | | |N| | | |6.59|6.59| |0| 185 455701400 | |0| | | |76|737|61|RP | | 233 Recipient_ID=104995226899 Recipient_ID_Inactive=. Valuation_Period_YYYYMM=201601 Aid_Group=38 Alien_Type_Code=. Amt_Annual_Income=0 Amt_FPL_Annual_Income=0 Amt_FPL_Monthly_Income=0 Amt_Monthly_Income=0 Case_Numb=1045163266 Case_Seq_Numb=. Continuous_Month_Enrolled=23 Date_Birth_Recipient=19540822 Date_Valuation=18000101 Dual_Elig_Aid_Catgy= EDW_Member_Sub_Program_Code=. Family_Size=. FPL_Range_Code=. Frail_Confirm_Code=. Fund_Code_MARS=. Immigration_Status= I_Budget= I_BuyinA= I_BuyinB= I_Casualty_Case= I_Continuous_Enrollment= I_Credible_TPL= I_DOC=N I_Dual_Aid=N I_Emergency_Services_Only=N I_FPL_ICES=Y I_Frail=N I_Initial_Enrollment=N I_Low_Income_Caretaker=N I_Managed_Care=Y I_Medicare=N I_Medicare_PartA=N I_Medicare_PartB=N I_Medicare_PartD=N I_Native_American=N I_Newly_Elig=Y I_Plan_ID_Changed=N I_PMP_Change=N I_Pre_12Month_Elig= I_Refugee= I_Re_Enrollment= I_Spenddown= I_TMA=N I_TPL_Coverage= Level_of_Care=. Level_of_Care_Type= Percent_FPL_Annual=6.59 Percent_FPL_Monthly=6.59 PGM_1915i_Code=. Percent_Pre_12Month_Elig=0 Plan_Provider_ID=455701400 Primary_Care_Physician= PCP_Location_ID=0 MMIS_Public_Health_PGM_Code= MMIS_Public_Health_PGM_Code2= EDW_Public_Health_PGM_Code= Recipient_Addr_County=76 Recipient_Age_In_Months=737 Recipient_Age_In_Years=61 Recipient_Aid_Catgy=RP Recipient_Aid_Catgy2= TANF_Cash_Code=. _ERROR_=1 _N_=1
Since there aren't any "invalid" characters it would seem you didn't change the type of the variables. You need to show the code part of the log, not just the error message.
Also make sure haven't end up with two copies of the data step, one with the change and one without. That is really easy to have happen when using Display Manager and the RECALL command.
Expand your code:
input
Recipient_ID
Recipient_ID_Inactive
Valuation_Period_YYYYMM :yymmn6.
Aid_Group
Alien_Type_Code
Amt_Annual_Income
Amt_FPL_Annual_Income
Amt_FPL_Monthly_Income
Amt_Monthly_Income
Case_Numb
Case_Seq_Numb
Continuous_Month_Enrolled
Date_Birth_Recipient :yymmdd8.
Date_Valuation :yymmdd8.
Dual_Elig_Aid_Catgy $
EDW_Member_Sub_Program_Code :$1.
Family_Size
FPL_Range_Code :$1.
Frail_Confirm_Code
Fund_Code_MARS
Immigration_Status $
I_Budget $
I_BuyinA $
I_BuyinB $
I_Casualty_Case $
I_Continuous_Enrollment $
I_Credible_TPL $
I_DOC $
I_Dual_Aid $
I_Emergency_Services_Only $
I_FPL_ICES $
I_Frail $
I_Initial_Enrollment $
I_Low_Income_Caretaker $
I_Managed_Care $
I_Medicare $
I_Medicare_PartA $
I_Medicare_PartB $
I_Medicare_PartD $
I_Native_American $
I_Newly_Elig $
I_Plan_ID_Changed $
I_PMP_Change $
I_Pre_12Month_Elig $
I_Refugee $
I_Re_Enrollment $
I_Spenddown $
I_TMA $
I_TPL_Coverage $
Level_of_Care
Level_of_Care_Type $
Percent_FPL_Annual
Percent_FPL_Monthly
PGM_1915i_Code
Percent_Pre_12Month_Elig
Plan_Provider_ID
Primary_Care_Physician $
PCP_Location_ID
MMIS_Public_Health_PGM_Code $
MMIS_Public_Health_PGM_Code2 $
EDW_Public_Health_PGM_Code $
Recipient_Addr_County
Recipient_Age_In_Months
Recipient_Age_In_Years
Recipient_Aid_Catgy $
Recipient_Aid_Catgy2 $
TANF_Cash_Code
;
format
Valuation_Period_YYYYMM yymmn6.
Date_Birth_Recipient Date_Valuation yymmdd8.
;
so your codes are read as codes, and date values as such. You should also make sure to correctly set the lengths for all the other character variables. Just using the $ sign (which sets a default length of 😎 may either be too short, so you eventually lose content, or too long, wasting space.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.