Hi All. I have attached dummy data. I need to import do the sum function for Date's column. The problem here is each time when I get the data the dates will change. I need SAS code which import data and do the sum function as and when the date change. Currently I am doing it manually using infile,informat ,format and Input code to get the data in to SAS then apply sum function on this. When I get the new data I manually change the dates in informat ,format and Input code and Sum code Pleas find the code below.. I need to automate the manual part. %Macro Import(xxxx); data &xxxx.; infile "Folder Path" delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 ; informat COMBO $41. ; informat PL $50. ; Manual Copying each time if the dates are new --------------------------------------------- Informat "2024-01-01"N best32.; Informat "2024-02-01"N best32.; Informat "2024-03-01"N best32.; Informat "2024-04-01"N best32.; Informat "2024-05-01"N best32.; Informat "2024-06-01"N best32.; format COMBO $41. ; format PL $50. ; Manual Copying each time if the dates are new --------------------------------------------- format "2024-02-01"N best12.; format "2024-03-01"N best12.; format "2024-04-01"N best12.; format "2024-05-01"N best12.; input COMBO $ PL $ Manual Copying each time if the dates are new --------------------------------------------- "2024-01-01"N "2024-02-01"N "2024-03-01"N "2024-04-01"N "2024-05-01"N 2024-06-01"N "2024-07-01"N ; run; proc sql; Create table xxxxx_xxxx_&xxxx AS select * from &xxx. where upcase(PL) LIKE'X2'; quit; proc sql; Create table xxx_Summary_&xxx AS select A,B,C,D, Manual Copying each time if the dates are new --------------------------------------------- Sum("2024-01-01"N) as "Jan-2024"N, Sum("2024-02-01"N) as "Feb-2024"N,Sum("2024-03-01"N) as "Mar-2024"N, Sum("2024-04-01"N) as "Apr-2024"N,Sum("2024-05-01"N) as "May-2024"N, Sum("2024-06-01"N) as "Jun-2024"N,Sum("2024-07-01"N) as "Jul-2024"N, from xxxxx_xxxx_&xxxx Group by A,B, C,D; quit;
... View more