- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The objective here is to output a raw data file. I know that Put and File are used to write raw data file. I am not sure here there is INFILE which is used to read data, cards, missover and text and lrecl?
data _null_;
infile cards missover length=l;
length text $ 50;
input text $varying50. l;
file aprdata pad lrecl=80;
put text;
datalines;
Akron 04/05/99 04/09/99 175.00 298.45
Brown 04/12/99 05/01/99 125.00 326.78
Carnes 04/27/99 04/29/99 125.00 174.24
Denison 04/11/99 04/12/99 175.00 87.41
Fields 04/15/99 04/22/99 175.00 378.96
Jamison 04/16/99 04/23/99 125.00 346.28
;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First let us make sure that you know that:
DATALINES (or CARDS) Informs SAS that the input data resides inside the code (in-stream data) and immediately follows the DATALINES (or CARDS) statement.
Senond thing is:
You may use the INFILE statement with the DATALINES (or CARDS) to process instream data and still utilize other INFILE options.
And here in your example INFILE options missover and length= are utilized in reading the in-stream data. Both you can read about here INFILE Statement
Finally, based on previous posts by you i can understand that you are preparing for the base certification. And what i hope is you do not be confused by this sample data code with the book. This code generate data used in the book and you are not asked to know every thing in that code at least for the base exam. You are not going to get any questions out of the exam scopes or reading difficult raw data not covered in the certification book.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First let us make sure that you know that:
DATALINES (or CARDS) Informs SAS that the input data resides inside the code (in-stream data) and immediately follows the DATALINES (or CARDS) statement.
Senond thing is:
You may use the INFILE statement with the DATALINES (or CARDS) to process instream data and still utilize other INFILE options.
And here in your example INFILE options missover and length= are utilized in reading the in-stream data. Both you can read about here INFILE Statement
Finally, based on previous posts by you i can understand that you are preparing for the base certification. And what i hope is you do not be confused by this sample data code with the book. This code generate data used in the book and you are not asked to know every thing in that code at least for the base exam. You are not going to get any questions out of the exam scopes or reading difficult raw data not covered in the certification book.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mohammed,
Can you tell me why they have 'text' there?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
"text" is just a variable name, you can replaced by any valid name...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
ok, but what does it do to the put statement? I know that put is the same as input but for writing data to an external file. Usually we have several variable for the number of column in the put statement but here we have "text" only.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
because as you can see. They red each line in the data lines as one string variable.
To get a better idea run the code without puting to file
data new;
infile cards missover length=l;
length text $ 50;
input text $varying50. l;
datalines;
Akron 04/05/99 04/09/99 175.00 298.45
Brown 04/12/99 05/01/99 125.00 326.78
Carnes 04/27/99 04/29/99 125.00 174.24
Denison 04/11/99 04/12/99 175.00 87.41
Fields 04/15/99 04/22/99 175.00 378.96
Jamison 04/16/99 04/23/99 125.00 346.28
;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Mohamed.