Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Repeating n times a certain character

Posted on 2010-11-29
5
Medium Priority
?
784 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
In this article, we’ll look at how to deploy ProxySQL.
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

636 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