BookmarkSubscribeRSS Feed
Batman
Quartz | Level 8

I'm trying to create a dataset from some columns I copied from a text file.  Ideally, I'd like the roman numerals to appear in the first column and the numbers with the decimals in the second column, both as text variables.   However, SAS isn't recognizing the space that separates the two columns.   See what the put statement yields below.

 

data Sel;

input rom $ num $;

datalines;

 

i. 290.0

ii. 290.1

;

run;

 

data null;

set sel;

put rom= num=;

run;

 

The put statement yield the following in the log.

 

rom=i. 290.0 num=ii. 290.

1 REPLY 1
ballardw
Super User

Blank lines in a datalines block are seldom a good idea.

This seems to work for me but it is possible that between pasting to the forum message window, my copy and paste into the editor and running the code removed a problem character.

data Sel;
input rom $ num $;
datalines;
i. 290.0
ii. 290.1
;
run;

I suggest going back to your editor, copying the code and then pasting into a code box opened using the forum {I} icon so you are pasting in a plain text box.

 

I suspect that you may have copied data from a TAB delimited file which would look like spaces but aren't. That could be tested by adding an infile statement to us tabs:

data Sel;
infile datalines dlm='09'x;
input rom $ num $;