forked from Jiangtang/SAS_ListProcessing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuffix.sas
37 lines (34 loc) · 1.48 KB
/
suffix.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*<pre><b>
/ Program : suffix.sas
/ Version : 1.0
/ Author : Roland Rashleigh-Berry (http://www.datasavantconsulting.com/roland/)
/ Date : 12-Jun-2011
/ Purpose : Function-style macro to return a list with a suffix added.
/ SubMacros : none
/ Notes : Items in matching quotes are treated as single elements
/ Usage : %let sufflist=%suffix(.sas,fname1 "fname 2" fname3);
/ %put %suffix(.sas,fname1 "fname 2" fname3);
/
/===============================================================================
/ PARAMETERS:
/-------name------- -------------------------description------------------------
/ suffix (pos) Text to suffix each item with (unquoted)
/ list (pos) List of items to suffix (separated by spaces)
/===============================================================================
/ AMENDMENT HISTORY:
/ init --date-- mod-id ----------------------description------------------------
/
/===============================================================================
/ This is public domain software. No guarantee as to suitability or accuracy is
/ given or implied. User uses this code entirely at their own risk.
/=============================================================================*/
%macro suffix(suffix,list);
%local i bit;
%let i=1;
%let bit=%sysfunc(scanq(&list,&i,%str( )));
%do %while(%length(&bit));
&bit.&suffix
%let i=%eval(&i+1);
%let bit=%sysfunc(scanq(&list,&i,%str( )));
%end;
%mend suffix;