BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
lloydc
Calcite | Level 5

I am trying to prompt a user via a couple of windows for information. The first window prompts for the last two digits of an I/P address and a model type.

I am trying to build a windows file name. Our departmental standard has a convention like:      'z:\Mainframe\MF 47_'xx     where      xx      is the two digit I/P value and there are subsequent nodes of the file name to follow.

Data Work.GetIP;

      if _n_ = 1 then do;

            format Last2IP $2.;

            format VSPPLAT $4.;

            format configr1 $250.;

            format tdrv1 tdrv1a tdrv2 $120.;

       window GetBoxNo irow=1 rows=15 color=white

            #3 @10 'Enter the last two digits of the I/P address:'

                 +2 Last2IP attr=underline autoskip persist=yes

            #5 @10 'Enter Platform (ie: R700, R800):'

                 +2 VSPPLAT attr=underline persist=yes;

       display GetBoxNo blank;

     /*     so let's assume the user replies     85     to the prompt for      Last2IP     and     R800     for the prompt for      VSPPLAT                                                            */

  /* here is the first problem: trying to get the variable     configr1     to equal     z:\Mainframe\MF_47.85\Configs\Report_140531_CreateConfigurationReport\CSV               */

      tdrv1 = trim("z:\Mainframe\MF_");

      tdrv1a = cat(tdrv1,Last2IP);

      tdrv2 = trim("\Configs\Report_140531_CreateConfigurationReport\CSV");

      tdrv2a = cat(tdrv1a,tdrv2a);

      configr1 = tdrv2a;

     /*      I have tried a number of ways of concatenating a string     ("z:\Mainframe\MF_47." )     and     Last2IP     and then the string     "\Configs\Report_140531_CreateConfigurationReport\CSV")

               but run into problems with length of values or it leaves the Last2IP value out     */

     /*      Next problem: I want to retain the items entered in the previous box (but not allow update here) and display a prompt for the file name of the configuration report...displayed but the user can

               over-type if they aren't meeting the standard or the date of the report is different     */

      window GetRpt irow=1 rows=10 color=white

            #3 @10     'Enter the last two digits of the I/P address:'

               +2       Last2IP persist=yes protect=yes

            #5 @10      'Enter Platform (ie: R700, R800):'

               +2       VSPPLAT persist=yes protect=yes

            #7 @10      'Enter Filename for Configuration Report:' /

               @15      configr1 ;

       display GetRpt;

/*      I would like the cursor to tab directly to line-8, column-15 where the variable      configr1     begins but that may not be possible.     */

/*     below is relevant to subsequent steps and macro calls     */

       %LET VSPIP = Ntests;

       %LET VSPVERS = VSPPLAT;

       output;

       stop;

  end;

  output;

  STOP;

  run;

quit;

proc print data=Work.GetIP;

run;

quit;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Some basics on concatenation:

Many component strings will carry there full length, ie. leading or trailing blanks, unless removed. The older trim(left(string)) or strip(string) need to be applied at specific places. OR look at the CATT CATS CATX and possible CATQ functions.

Likely you want CATS instead of CAT.

Also look at the length of returned strings with functions.

("z:\Mainframe\MF_47." )     and     Last2IP     and then the string     "\Configs\Report_140531_CreateConfigurationReport\CSV")

configr1= cats("z:\Mainframe\MF_47.",Last2IP, "\Configs\Report_140531_CreateConfigurationReport\CSV");

you may even find

configr1 = cats(tdrv1,Last2ip,tdrv2);

will work without all of the reassignements and trim calls.

View solution in original post

2 REPLIES 2
ballardw
Super User

Some basics on concatenation:

Many component strings will carry there full length, ie. leading or trailing blanks, unless removed. The older trim(left(string)) or strip(string) need to be applied at specific places. OR look at the CATT CATS CATX and possible CATQ functions.

Likely you want CATS instead of CAT.

Also look at the length of returned strings with functions.

("z:\Mainframe\MF_47." )     and     Last2IP     and then the string     "\Configs\Report_140531_CreateConfigurationReport\CSV")

configr1= cats("z:\Mainframe\MF_47.",Last2IP, "\Configs\Report_140531_CreateConfigurationReport\CSV");

you may even find

configr1 = cats(tdrv1,Last2ip,tdrv2);

will work without all of the reassignements and trim calls.

lloydc
Calcite | Level 5

Thanks, I'd tried a couple of variations of the CAT,CATS,CATX functions but this last statement worked perfectly.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 825 views
  • 0 likes
  • 2 in conversation