I am importing data from excel, and the file will update everyday. How do I refresh my program without having to create a new program?
Correct - if your excel sheet has additional rows of data each day, you would just read the excel sheet into SAS and overwrite yesterday's SAS table.
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Please provide a lot more details about the situation and what is happening when the "file will update everyday" and how you will know it has updated and why you would have to create a new program.
Is the updated file in the same location?
Does it have the same name or a different name? If different names, how does the name change or how do you know which is the file to read. (There are lots of posts in this forum about reading files with dates in the name , a search may find what you need).
Same sheet names every time?
Will the previously read file still be there?
Does the layout change? i.e. order of value columns change, number of columns change, value types in a column changing from all numeric to character or vice versa, or data starting on different rows.
Do you know the maximum length that will ever occur in each character field?
Will there be anyone putting stupid line breaks into text fields (the Alt-Enter)?
How would you currently import ONE of these files?
(HINT: if using proc import the results are likely to be unreliable in the long run).
@NickA1 wrote:
What is happening is every day, new data is being added to each variable. So I have stock prices and every day the closing price from the last day should be added in. I am using proc import and none of the names of the file or the sheets is changing. Neither is the number of variables , column names or anything like that. I am simply adding a row of new data at the end of the existing file.
Based on this description, you shouldn't need to change your program at all.
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
@NickA1 wrote:
This seems to not work
We don't know what this means. Please explain and provide details. If there is an ERROR message, post the entire log (not just the error message) in the window that appears when you click on the {i} icon — do not post the log without clicking on the {i} icon.
Correct - if your excel sheet has additional rows of data each day, you would just read the excel sheet into SAS and overwrite yesterday's SAS table.
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.