BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
SuperSaiyan
Calcite | Level 5

Hello is there a way to shorten this?
data have;
infile ;
@5 var1 1.
@6 var2 1.
@7 var3 1.
@8 var4 1.
@9 var5 1.
@10 var6 1.
@11 var7 1.
@12 var8 1.
@13 var9 1.
@14 var10 1.
@15 var11 1.
@16 var12 1.
@17 var13 1.
@18 var14 1.
@19 var15 1.
@20 var16 1.
@21 var17 1.
@22 var18 1.
@23 var19 1.
@24 var20 1.
;
run;

 

the data im trying to export has no delimiters hence the width and column number.

I tried @5 var1-var20 but getting errors, how do I use the numbered range variable list with data that has no delimiters (i.e 1234567891011222222267)?

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Try it this way:

 

input @5 (var1-var20) (1.);

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

My obs:

1. export to where?

2. What kind of external file

3. what kind of delimiters you want to separate data

4. choice of statements such as file(routing to external file) and put is missing, why?

5. have you considered export procedure?

6. what is the null infile statement doing

and many more

SuperSaiyan
Calcite | Level 5

infile 'test.txt';

 

SuperSaiyan
Calcite | Level 5
the data on the txt file has no delimiters (meaning no spaces or whatever) example 12345678910 each has name var1 var2 var3 var4 .... and so on, but this is too long, iwant to use var1-varn, but cannot get it
Astounding
PROC Star

Try it this way:

 

input @5 (var1-var20) (1.);

SuperSaiyan
Calcite | Level 5
Thank you! It worked!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 834 views
  • 0 likes
  • 3 in conversation