BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
IgorR
Quartz | Level 8

Hi!

I'm trying to create a table with data. where the first column must be numerical(integer) and second column must be float number.

The following code does it except first 9 rows where int number is less then 10.

The code:

DATA Lapse_Multipliers;
  input Years 1-2 Lapse_Multipliers 3-6;
  DATALINES;
1	1
2	1
3	1
4	1
5	1
6	0.9
7	0.8
8	0.7
9	0.5
10	1
11	1
12	1
13	1
14	1
15	1
16	0.9
17	0.8
18	0.7
19	0.5
20	1
;
run;

It returns:

.	1
.	1
.	1
.	1
.	1
.	0.9
.	0.8
.	0.7
.	0.5
10	1
11	1
12	1
13	1
14	1
15	1
16	0.9
17	0.8
18	0.7
19	0.5
20	1

What am I missing?

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Do not use tabs in DATALINES blocks, unless you want to use them explicitly as delimiters, in which case your code should be

data lapse_multipliers;
infile datalines dlm="09"x dsd;
input Years Lapse_Multipliers;
datalines;
1	1

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

Do not use tabs in DATALINES blocks, unless you want to use them explicitly as delimiters, in which case your code should be

data lapse_multipliers;
infile datalines dlm="09"x dsd;
input Years Lapse_Multipliers;
datalines;
1	1
IgorR
Quartz | Level 8
Thank you!
Now it works.
The data in datalines comes with Tabs because I'm copy-pasting the data from excel file.
Tom
Super User Tom
Super User

@IgorR wrote:
Thank you!
Now it works.
The data in datalines comes with Tabs because I'm copy-pasting the data from excel file.

You must be stuck with using SAS/Studio interface instead of Display Manager.

 

In Display Manager you are protected from the tabs that accidentally get into your code because when you SUBMIT the code any tabs are replaced by the appropriate number of spaces to move to the next tab stop.

 

Note that SAS let's you fix this by changing your preferences settings so that spaces are substituted for tabs.  So when typing you can still hit the TAB key to indent code, but without the complication of having actual '09'x characters hiding in your code.

Tom_0-1691328565210.png

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 828 views
  • 0 likes
  • 3 in conversation