Solved

Repeating n times a certain character

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

Upcoming Webinar: Securing your MySQL/MariaDB data

Join Percona’s Chief Evangelist, Colin Charles as he presents Securing your MySQL®/MariaDB® data on Tuesday, July 11, 2017 at 7:00 am PDT / 10:00 am EDT (UTC-7).

Question has a verified solution.

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

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
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…
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…

688 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