- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a text file with values as mentioned below. How to import these into SAS with the headers as 1. Date 2. Values?. The dates should be in the date column and the values to be in the other column. I dont want to edit the text file.
1Sep11 389.00 1Oct11 491.00 1Nov11 370.00 1Dec11 335.00
and so on.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please attach your text file with the first 3 rows. That makes it much easier for us to give you a response.
Alternatively: Use the Import Task in SAS EG or SAS Studio - that might already support you enough to solve this task on your own.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
1Sep11 389.00 1Oct11 491.00 1Nov11 370.00 1Dec11 335.00
2Sep11 423.00 2Oct11 478.00 2Nov11 407.00 2Dec11 442.00
3Sep11 482.00 3Oct11 300.00 3Nov11 303.00 3Dec11 372.00
These are the first three lines of the code. I am using SAS 9.0 system for windows. Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can actually ATTACH files instead of posting the data directly into the text. This is sometimes the better option as it provides us with your actual data in the actual format.
How to import these into SAS with the headers as 1. Date 2.
Where are these headers? Are they the first row in your text file or does your text file directly start with data? Providing the data as an attachment would anser all these questions and also allow us to show you how to use the Import Wizards.
You're using SAS 9.0! Why? I hope no serious organization is still using this version. Is this a"hack" version you found on Internet? If so and that's for you onw learning and not for commercial usage then dowload the official, up-to-date and free of charge SAS UE distribution here: https://www.sas.com/en_au/software/university-edition/download-software.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's an approach that should work:
data want;
infile rawdata;
informat date date9.;
input date value @@;
format date yymmdd10.;
run;
You will get a message about SAS moving to a new line when it reached past the end of the current line. For this program, that note is expected and can be ignored.