- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data bank2;
infile datalines dsd;
input name $ rate;
datalines;
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
;
run;
proc print data = bank2;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your sample program is most of the solution. However, by reading across from left to right and taking whatever is found in the data, the program has to decide how many characters to use to store NAME. In that situation, the software automatically uses a length of 8, so values of NAME will be truncated. To fix that, define NAME before the INPUT statement:
data bank2;
infile datalines dsd;
length name $ 15;
input name $ rate;
datalines;
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
;
Just select a length that makes sense for the data you need to read.
Also note, if some values of NAME contain an embedded blank such as "First Capital", you will need to take additional steps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you are getting errors, please post your log.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
the variable name is 'name' and 'rate' .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Your sample program is most of the solution. However, by reading across from left to right and taking whatever is found in the data, the program has to decide how many characters to use to store NAME. In that situation, the software automatically uses a length of 8, so values of NAME will be truncated. To fix that, define NAME before the INPUT statement:
data bank2;
infile datalines dsd;
length name $ 15;
input name $ rate;
datalines;
FirstCapital 0.0718
DirectBank 0.0721
VirtualDirect 0.0728
;
Just select a length that makes sense for the data you need to read.
Also note, if some values of NAME contain an embedded blank such as "First Capital", you will need to take additional steps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content