?
Solved

Repeating n times a certain character

Posted on 2010-11-29
5
Medium Priority
?
786 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
In this article, we’ll look at how to deploy ProxySQL.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

839 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