BookmarkSubscribeRSS Feed
thanikondharish
Fluorite | Level 6

Ruth 39 11
Jose 32 22
Sue 30 33
John 40 44

 

data test ;
infile 'C:\Users\LENOVO\Desktop\test.txt' ;
input a $1-4 ;
if a='Ruth' then input idnum 10-11 ;
else input age 7-8 ;
run;

 

 

it gives only ruth what about idnum,age.

it shows missing values in age,numeric variables

1 REPLY 1
Kurt_Bremser
Super User

You forgot to hold the row pointer with @.

And since the columns are not at fixed places, you mostly try to read blanks for numbers.

STRONG hint: when posting examples of external files, ALWAYS use the {i} button, as that subwindow keeps the vertical alignment as-is. The main posting window tends to eat successive blanks, or replace tab characters.

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1227 views
  • 2 likes
  • 2 in conversation