Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to replace the blanks in macro "global"

    Code:
    global ctrl firmAge lnEmplNum  lnTtlAsset lnRDMoney patentCount1  highTech innovEntAward  
    global ctrlNonMissing = stritrim("$ctrl") //this step doesn't work
    global ctrlNonMissing: subinstr global ctrlNonMissing " " ", ",all
    how to replace the blanks in macro "global", just leave one blank between elements of macro.
    Thanks!

  • #2
    Code:
    help macrolists
    and then scroll down to the entry for retokenize.

    Comment


    • #3
      In what way do your second line not work? The $ctrl in your posted example code have 8 spaces char(32), and $ctrlNonMissing will have 6 spaces. stritrim() trims char(32) only, if you have other space characters in your string:
      Code:
      global ctrlNonMissing = ustrregexra("$ctrl", "\s+", char(32))
      Last edited by Bjarte Aagnes; 25 Dec 2021, 05:39.

      Comment


      • #4
        Originally posted by Bjarte Aagnes View Post
        In what way do your second line not work? The $ctrl in your posted example code have 8 spaces char(32), and $ctrlNonMissing will have 6 spaces. stritrim() trims char(32) only, if you have other space characters in your string:
        Code:
        global ctrlNonMissing = ustrregexra("$ctrl", "\s+", char(32))
        Oh, sorry, this works. I made a mistake here.

        Comment

        Working...
        X