BookmarkSubscribeRSS Feed
sheetalmahana
Calcite | Level 5

Hi, 

I am using SAS EG 9.4. I have to update monthly data using SAS. Monthly files are named in raw_file_<mmm-yy> format. Columns in all the files are in same order. Below is the code that I used for 2 months- Jul and Aug 18. However, now i need to this activity for past 1 year in same format. Going forward, i will have to do this activity for every month. After this, i need to merge all this files into 1 master file for further analysis. Please help in automating the code using macro to make it efficient and fast. 

 

data work.raw_file_Jul18;

        FORMAT

                year_month date9.

                Name $char12.

                Age BEST8.

                department $char12.

                salary dollar12.2;

        INFORMAT

                 year_month date9.

                Name $char12.

                Age BEST8.

                department $char12.

                salary dollar12.2;

         infile "c:/user/data_Jul18"

         dlm=';'

         MISSOVER
         DSD
         firstobs=2
         lrecl = 32767 ;

input 

         year_month date9.

         Name $char12.

         Age BEST8.

         department $char12.

         salary dollar12.2;

run;

 

3 REPLIES 3
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Need further information.  What software are you using.  Where is the file (sftp, local drive etc.)?  What is the file called?  Do you have command line access?  Is the file the same each time - i.e. do you have an import agreement which shows the structure?  Anything else needed for the append - date calculation etc.?

 

In theory its just a matter of importing the file and then appending to the existing data, but that is with the very little information you have presented.

sheetalmahana
Calcite | Level 5

Hi RW9, Added more information to the question. Hope this helps. thanks in advance 

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
  • 3 replies
  • 907 views
  • 0 likes
  • 2 in conversation