02-21-2014 02:52 AM
Hi SAS Community!
Is there a way to create a date variable when importing a .csv file ?
In other words, I want to import the file, and then additionally I want to create a new variable (that will be included in the data set) to display the date of when the file was created.
Do you guys have any suggestions ?
02-21-2014 04:26 AM
In a datastep after the input 'section' put something like this
infile 'path_file' <option>;
var1 ... varn
Work on the the datastep that i wrote because it's just an example
02-21-2014 04:33 AM
Thank you for the reply Barnipaz .
But wouldn't this just give the present date ? I'm trying to create a variable that will show when this file (the excel file) was created, that is 2013/xx/xx.
02-21-2014 04:47 AM
If you know the date, for example February 3rd 2013
If you get it from some place, for example from the file name, get it and put in the expression. There are function the take the file name.
I'l give you a tip, a very important one.
Study all the function, format, informat and, all macrovariable created by default. With them you can do almost everything in SAS.
Need further help from the community? Please ask a new question.