Solved

Repeating n times a certain character

Posted on 2010-11-29
5
763 Views
Last Modified: 2013-11-16
HI,

Code below gives an error. When i replace aant by 80 then it works.
What i'm doing wrong?
&best is the name of an excel.

DATA _NULL_ ;
      aant = LENGTH("&best") ;
      aant = aant + 14 ;
      PUT aant*'-' ;
      PUT "Transfer to : " "&best" ;
      PUT aant*'-' ;
RUN ;
0
Comment
Question by:sonmic
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Aloysius Low
ID: 34230459
what is the error message? including the error message would be more helpful than saying that there's an error with the code...

also, could you care to explain what are you trying to achieve with the code?
0
 

Author Comment

by:sonmic
ID: 34230670
I want to show the user the path where the excel is written to.

ERROR :
11308        PUT aant*'-' ;
                                -
                              22
                               ---
                             200
ERROR 22-322: Syntax error, expecting one of the following: a name, an integer constant, arrayname, #, $, &, (, +, -, /, //, :, ;, =,
              ?, @, @@, OVERPRINT, [, _ALL_, _BLANKPAGE_, _ODS_, _PAGE_, {, ~.

ERROR 200-322: The symbol is not recognized and will be ignored.

ERROR 200-322: The symbol is not recognized and will be ignored.
0
 
LVL 14

Expert Comment

by:Aloysius Low
ID: 34230758
ok... if you would like to show the path where the file is written to, isn't the line  PUT "Transfer to : " "&best" ; alone be sufficient? what is the purpose of having the line PUT aant*'-' ;?

Am i missing something here, or not understanding the problem?
0
 

Author Comment

by:sonmic
ID: 34230812
Because the visibility is better than. When i use PUT 80*"-" then it works. But the length of the path/file can be different en want that the "-" have the same length as the path/file.
0
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 500 total points
ID: 34235619
i see...

in that case, you'll need to break up the step into 2 data steps...

the statement will only work with variables that resolves to an actual value, not dataset attributes or variables within the data _NULL_ step...

DATA _NULL_ ;
      aant = LENGTH("&best") ;
      aant = aant + 14 ;
      call symput("aant", aant);
RUN;

DATA _NULL_ ;
      PUT &aant*'-' ;
      PUT "Transfer to : " "&best" ;
      PUT &aant*'-' ;
RUN ;

let me know if this works for you :)
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Creating and Managing Databases with phpMyAdmin in cPanel.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now