BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NickA1
Calcite | Level 5

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?

1 ACCEPTED SOLUTION

Accepted Solutions
noling
SAS Employee

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

View solution in original post

8 REPLIES 8
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

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
Calcite | Level 5
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.
PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
NickA1
Calcite | Level 5
So I can jus rerun the program and it will add the new data? This seems to not work
ballardw
Super User

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.

PaigeMiller
Diamond | Level 26

@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.

--
Paige Miller
noling
SAS Employee

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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 2385 views
  • 0 likes
  • 4 in conversation