I suggest you start reading the SAS documentation, because your code has so many errors resulting from missing knowledge.
data INFLE2;
infile DD01;
input
@36 YearX 4.
@1 Record $char150.;
if YearX = year(today());
run;
show us some code 🙂
Show us some code and show us some test data data in the form of a datastep.
E.g.:
data have; input year; datalines; 2013 2017 ; run;
Something like this?
data years;
input year;
datalines;
2013
2014
2015
2016
2017
;
run;
proc print data=years; where year=year(today()); run;
Input file is of 150.. Year is starting at 36th.. A0214494 FLDNIW0000414600DRIN 201401010.... A0214494 FLDNIW0000104200CRIN 201401010.. A0330094 FLDQIW0000104200CRSD 201401010.. SAS code: DATA INFLE1; DATERUN = TODAY(); FINAL_YEAR=YEAR(DATERUN); FORMAT FINAL_YEAR YEAR4. ; RUN ; PROC PRINT DATA=INFLE1; DATA INFLE2; INFILE DD01; INPUT @36 YEARX 4. @1 RECORD $CHAR150.; FORMAT YEARX YEAR4.; RUN; PROC PRINT DATA=INFLE2; DATA OUTP1; SET INFLE1 INFLE2; IF YEARX = FINAL_YEAR THEN OUTPUT OUTP1 ; RUN; DATA FINAL1; SET OUTP1 ; FILE DD01O; PUT @1 RECORD $CHAR150.; RUN;
YEARX = FINAL_YEAR is not working ... i have tried other formatting options too... like took input year in Char as well.. but 0 records in output..
I think issue is ..sas 's internal format.. 2017 would mean..1965 when i am moving it into YEAR4....
I suggest you start reading the SAS documentation, because your code has so many errors resulting from missing knowledge.
data INFLE2;
infile DD01;
input
@36 YearX 4.
@1 Record $char150.;
if YearX = year(today());
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.