DATA ABC; INFILE CARDS DSD MISSOVER DLM="~"; INPUT DATE DATE9. AMT ONE TWO; CARDS; 01MAR2017~78 ; RUN; /* NEXT OBSERVATION = 02MAR2017~90 */ LIBNAME HOME "C:/WORKSHOP"; PROC SQL; CREATE TABLE HOME.ABC LIKE ABC; QUIT; PROC SQL; CREATE TABLE HOME.BBC AS SELECT DATE ,AMT, CASE WHEN SUBSTR(PUT(DATE,DATE9.),1,2)="01" THEN AMT END AS ONE, CASE WHEN SUBSTR(PUT(DATE,DATE9.),1,2)="02" THEN AMT END AS TWO FROM ABC; QUIT; Well my requirement is 1] if today i'm running report and day of date is if "01" then its amount should populate in column named as "One". 2] Now when i would run report by tommorrow and lets say day of date is "02" then not only respective amount should populate in next column named as "Two" but also it should maintain the previous column amount data. so Running report for 01mar2017 : ouput should be : date | amt | one | two 01mar2017 | 78 | 78 | Running report for 02Mar2017 : ouput should be : date | amt | one | two 02mar2017 | 90 | 78 | 90 but my above code flushes previous values as i dont have data for previous date once it is passed. i dont wanto maintain data as its huge. So no transpose and no append. Just need to know some trick so that i will be able to retain those previous date column values.
... View more