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 $;

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 764 views
  • 0 likes
  • 2 in conversation