BookmarkSubscribeRSS Feed
JatinRai
Obsidian | Level 7
Support.sas.com states the following:

@n
moves the pointer to column n.

Range: a positive integer
Tip: If n is not an integer, SAS truncates the decimal value and uses only the integer value. If n is zero or negative, the pointer moves to column 1.

But when I tried the following code a syntax error appears:
data test;
infile tests obs=5;
input ID $ Name & $14. @-27 (a1-a5) (3.) Level $;
input ID $ Name & $14. @-27 (a1-a5) (3.) Level $;
run;

When I replaced -27 with 27.78 then also the syntax error appeared. Finally when I replaced 27.78 with 27 the program worked fine. Can someone explain that why is the Tip on support.sas.com not working? I'm using SAS 9.2.
1 REPLY 1
Doc_Duke
Rhodochrosite | Level 12
Again, which tip.

If is an expression, the operation works as described. I does fail as you described when you provide a literal.

The problem is that the compiler can't differentiate between, for instance, a subtraction and an infix operator because the context is not clear.

There is a pretty full discussion at
http://support.sas.com/documentation/cdl/en/lrdict/63026/HTML/default/viewer.htm#a000146292.htm

Doc Muhlbaier
Duke

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1 reply
  • 1198 views
  • 0 likes
  • 2 in conversation