I am new in SAS and am currently working at a rather large data set. I'm getting a error of the type:
NOTE: Invalid numeric data, 'dev' , at line 1304 column 173.
I want to create an %if conditional statement of this type:
if input data is numerical then continue else if format.20 .
How would I go about doing this, thank you very much in advance and please note this is my first 3 hours in using SAS. I have experience in python.
code currently looks like this:
dateVar=year(&dateVar.)*100+month(&dateVar.);
if &devSampleStart.<=dateVar<=&devSampleEnd. then
sample='dev';
else if &baseSampleStart.<=dateVar<=&baseSampleEnd. then
sample='base';
else if &recSample.=dateVar then
sample='rec ';
else sample=' ';
Copy of the log:
MPRINT(CALCMIGRATIONMATRIX): dateVar=year(snapshot_date1)*100+month(snapshot_date1);
SYMBOLGEN: Macro variable DEVSAMPLESTART resolves to 200709
SYMBOLGEN: Macro variable DEVSAMPLEEND resolves to 201809
MPRINT(CALCMIGRATIONMATRIX): if 200709<=dateVar<=201809 then sample='dev';
SYMBOLGEN: Macro variable BASESAMPLESTART resolves to 201909
SYMBOLGEN: Macro variable BASESAMPLEEND resolves to 201909
MPRINT(CALCMIGRATIONMATRIX): else if 201909<=dateVar<=201909 then sample='base';
SYMBOLGEN: Macro variable RECSAMPLE resolves to 202009
MPRINT(CALCMIGRATIONMATRIX): else if 202009=dateVar then sample='rec ';
MPRINT(CALCMIGRATIONMATRIX): else sample=' ';
SYMBOLGEN: Macro variable DATEVAR resolves to snapshot_date1
SYMBOLGEN: Macro variable BASESAMPLEEND resolves to 201909
MPRINT(CALCMIGRATIONMATRIX): if mod(month(snapshot_date1),100)=mod(201909,100) then yearlyTimeSlice=1;
MPRINT(CALCMIGRATIONMATRIX): else yearlyTimeSlice=0;
SYMBOLGEN: Macro variable ACCOUNTID resolves to account_id
SYMBOLGEN: Macro variable RATINGVAR resolves to rating
MPRINT(CALCMIGRATIONMATRIX): keep account_id rating dateVar sample yearlyTimeSlice;
MPRINT(CALCMIGRATIONMATRIX): run;
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
1304:173 1304:34 1304:120 1304:159
NOTE: Invalid numeric data, 'dev' , at line 1304 column 173.