Solved

Repeating n times a certain character

Posted on 2010-11-29
5
769 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

APEX (Application Express) is used to develop a web application from Oracle. SQL Workshop is one of the tools that comes with Oracle APEX to query or modify the database objects or to make any changes to the structure.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
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…

860 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