BookmarkSubscribeRSS Feed
marleeakerson
Calcite | Level 5

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. 

11 REPLIES 11
novinosrin
Tourmaline | Level 20

Hi @marleeakerson  Can you please post your 1.code 2. Log 3. A couple of lines of data that you are reading?

ballardw
Super User

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.

 

 

mbuchecker
Quartz | Level 8
I agree with the above comments. But a wild guess is that you also need to add the DSD option to the end of your INFILE statement.
Michelle
marleeakerson
Calcite | Level 5

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;

 

mbuchecker
Quartz | Level 8
Looking at the data, EDW_Member_Sub_Program_Code and FPL_Range_Code should be character. Please change those to $, and rerun the code and show the log and code.
Michelle
ballardw
Super User

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.

marleeakerson
Calcite | Level 5

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
Tom
Super User Tom
Super User

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.

mbuchecker
Quartz | Level 8
Because the log shows: EDW_Member_Sub_Program_Code=. that means this var is still being read as numeric. Notice how MMIS_Public_Health_PGM_Code2= That there is a blank after the equal sign instead of a period. Because there is a period after the equal sign for EDW_Member_Sub_Program_Code that's how we know SAS still thinks it is numeric.
Can you show us the log that has not only what you have in the previous post, but with the code in the log as well?
Michelle
Kurt_Bremser
Super User

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.

Ksharp
Super User
Change all these variables into CHARACTER variable.


INFILE file DLM="|" DSD LRECL=3200 TRUNCOVER ;
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
)
( : $200.)
;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 11 replies
  • 1891 views
  • 0 likes
  • 7 in conversation