Prev: Chordiant Developer for Richmond VA for 9 to 12 Months Contract
Next: first dot / last dot list processing help
From: feenberg on 15 Apr 2010 16:51 I want to pass a string included quotation marks to a SAS program via the SYSPARM option on the Unix command line (SUN Sparc), but can't seem to find a way to escape the quotes. I have tried single and double quotes, backslash escape, etc. Here are my first 5 tries: nber6%> sas test -sysparm "title 'a';" nber6%> sas test -sysparm "title ""a"";" nber6%> sas test -sysparm 'title "a";' nber6%> sas test -sysparm 'title ''a'';' nber6%> sas test -sysparm 'title \"a\";' All fail with the same error (to the console, no log is produced and the contents of test.sas don't affect the message): BTW, the "title" command is chosen strictly to motivate the question, there is more going on in my actual application to justify the need for quote marks. ERROR: Invalid file, /home/feenberg/a;.sas. This one fails with a different message: nber6%> sas test -sysparm 'title \'a\';' Unmatched ' Is there a way? Daniel Feenberg NBER ERROR: Invalid file, /disk/homes2c/nber/feenberg/taxcalc/\"a\";.sas.
From: data _null_; on 15 Apr 2010 21:30 On Apr 15, 3:51 pm, feenberg <feenb...(a)gmail.com> wrote: > I want to pass a string included quotation marks to a SAS program via > the SYSPARM option on the Unix command line (SUN Sparc), but can't > seem to find a way to escape the quotes. I have tried single and > double quotes, backslash escape, etc. Here are my first 5 tries: > > nber6%> sas test -sysparm "title 'a';" > nber6%> sas test -sysparm "title ""a"";" > nber6%> sas test -sysparm 'title "a";' > nber6%> sas test -sysparm 'title ''a'';' > nber6%> sas test -sysparm 'title \"a\";' > > All fail with the same error (to the console, no log is produced and > the contents of test.sas don't affect the message): > > BTW, the "title" command is chosen strictly to motivate the question, > there is more going on in my actual application to justify the need > for quote marks. > > ERROR: Invalid file, /home/feenberg/a;.sas. > > This one fails with a different message: > > nber6%> sas test -sysparm 'title \'a\';' > Unmatched ' > > Is there a way? > > Daniel Feenberg > NBER > > ERROR: Invalid file, /disk/homes2c/nber/feenberg/taxcalc/\"a\";.sas. I think the problem order. -SYSPARM should be before TEST I tested sas -sysparm 'title "a";' test.sas and it work as expected. resolving SYSPARM produced a valid title statement.
From: feenberg on 16 Apr 2010 19:12 On Apr 15, 9:30 pm, "data _null_;" <datan...(a)gmail.com> wrote: > On Apr 15, 3:51 pm,feenberg<feenb...(a)gmail.com> wrote: > > > > > > > I want to pass a string included quotation marks to a SAS program via > > theSYSPARMoption on the Unix command line (SUN Sparc), but can't > > seem to find a way to escape the quotes. I have tried single and > > double quotes, backslash escape, etc. Here are my first 5 tries: > > > nber6%> sas test -sysparm"title 'a';" > > nber6%> sas test -sysparm"title ""a"";" > > nber6%> sas test -sysparm'title "a";' > > nber6%> sas test -sysparm'title ''a'';' > > nber6%> sas test -sysparm'title \"a\";' > > > All fail with the same error (to the console, no log is produced and > > the contents of test.sas don't affect the message): > > > BTW, the "title" command is chosen strictly to motivate the question, > > there is more going on in my actual application to justify the need > > for quote marks. > > > ERROR: Invalid file, /home/feenberg/a;.sas. > > > This one fails with a different message: > > > nber6%> sas test -sysparm'title \'a\';' > > Unmatched ' > > > Is there a way? > > > DanielFeenberg > > NBER > > > ERROR: Invalid file, /disk/homes2c/nber/feenberg/taxcalc/\"a\";.sas. > > I think the problem order. -SYSPARMshould be before TEST > > I tested > > sas -sysparm'title "a";' test.sas > > and it work as expected. resolving SYSPARMproduced a valid title > statement. Maybe you have a more recent version of SAS. I have 9.1 and it doesn't work. Well, if I put "test" last, it helps to the extent that I now get a logfile, but the l ogfile shows &SYSPARM without substituting the title statement. This isn't solely because of the quotes because I can't get blanks into SYSPARM. either. For example, take a complete sas program: &SYSPARM; endsas; and invoke it with: sas -SYSPARM "proc options" test The log file comes back with the message: 1 &SYSPARM; _ 10 ERROR 10-205: Expecting the name of the procedure to be executed. 2 endsas; From the text of the error message I understand that SAS stopped parsing at the space before the word "options" - so SYSPARM needs to be a single word. I get the same result for single quotes or just escaping the space. Anyway, it looks like the SYSPARM paramter is not going to let me insert words into a title statement. It is clumsy, but I guess I can use %INCLUDE instead. Daniel Feenberg
From: Tom Abernathy on 16 Apr 2010 21:34 Check if your helpful system administrator has introduced a site customized script into your system that is wrapped around the actual program from SAS. We had a similar problem a few years ago and it was because the script they wrote was removing the grouping that the quotes put around the words and so they became separate strings in the actual command line that was generated to invoke SAS. The word GLOB comes to mind as the Unix speak for that grouping operation. The sh script that we have now is passing the user parameters to SAS using the syntax "$@" and we are no longer having troubles. On Apr 16, 7:12 pm, feenberg <feenb...(a)gmail.com> wrote: > On Apr 15, 9:30 pm, "data _null_;" <datan...(a)gmail.com> wrote: > > > > > > > On Apr 15, 3:51 pm,feenberg<feenb...(a)gmail.com> wrote: > > > > I want to pass a string included quotation marks to a SAS program via > > > theSYSPARMoption on the Unix command line (SUN Sparc), but can't > > > seem to find a way to escape the quotes. I have tried single and > > > double quotes, backslash escape, etc. Here are my first 5 tries: > > > > nber6%> sas test -sysparm"title 'a';" > > > nber6%> sas test -sysparm"title ""a"";" > > > nber6%> sas test -sysparm'title "a";' > > > nber6%> sas test -sysparm'title ''a'';' > > > nber6%> sas test -sysparm'title \"a\";' > > > > All fail with the same error (to the console, no log is produced and > > > the contents of test.sas don't affect the message): > > > > BTW, the "title" command is chosen strictly to motivate the question, > > > there is more going on in my actual application to justify the need > > > for quote marks. > > > > ERROR: Invalid file, /home/feenberg/a;.sas. > > > > This one fails with a different message: > > > > nber6%> sas test -sysparm'title \'a\';' > > > Unmatched ' > > > > Is there a way? > > > > DanielFeenberg > > > NBER > > > > ERROR: Invalid file, /disk/homes2c/nber/feenberg/taxcalc/\"a\";.sas. > > > I think the problem order. -SYSPARMshould be before TEST > > > I tested > > > sas -sysparm'title "a";' test.sas > > > and it work as expected. resolving SYSPARMproduced a valid title > > statement. > > Maybe you have a more recent version of SAS. I have 9.1 and it doesn't > work. > Well, if I put "test" last, it helps to the extent that I now get a > logfile, but the l > ogfile shows &SYSPARM without substituting the title statement. > > This isn't solely because of the quotes because I can't get blanks > into SYSPARM. > either. For example, take a complete sas program: > > &SYSPARM; > endsas; > > and invoke it with: > > sas -SYSPARM "proc options" test > > The log file comes back with the message: > 1 &SYSPARM; > _ 10 > ERROR 10-205: Expecting the name of the procedure to be executed. > 2 endsas; > > From the text of the error message I understand that SAS stopped > parsing > at the space before the word "options" - so SYSPARM needs to be a > single > word. I get the same result for single quotes or just escaping the > space. Anyway, > it looks like the SYSPARM paramter is not going to let me insert words > into > a title statement. It is clumsy, but I guess I can use %INCLUDE > instead. > > Daniel Feenberg- Hide quoted text - > > - Show quoted text -
From: feenberg on 19 Apr 2010 18:14
On Apr 16, 9:34 pm, Tom Abernathy <tom.aberna...(a)gmail.com> wrote: > Check if your helpful system administrator has introduced a site > customized script into your system that is wrapped around the actual > program from SAS. We had a similar problem a few years ago and it was > because the script they wrote was removing the grouping that the > quotes put around the words and so they became separate strings in the > actual command line that was generated to invoke SAS. The word GLOB > comes to mind as the Unix speak for that grouping operation. The sh > script that we have now is passing the user parameters to SAS using > the syntax "$@" and we are no longer having troubles. > > On Apr 16, 7:12 pm,feenberg<feenb...(a)gmail.com> wrote: > > > > > On Apr 15, 9:30 pm, "data _null_;" <datan...(a)gmail.com> wrote: > > > > On Apr 15, 3:51 pm,feenberg<feenb...(a)gmail.com> wrote: > > > > > I want to pass a string included quotation marks to a SAS program via > > > > theSYSPARMoption on the Unix command line (SUN Sparc), but can't > > > > seem to find a way to escape the quotes. I have tried single and > > > > double quotes, backslash escape, etc. Here are my first 5 tries: > > > > > nber6%> sas test -sysparm"title 'a';" > > > > nber6%> sas test -sysparm"title ""a"";" > > > > nber6%> sas test -sysparm'title "a";' > > > > nber6%> sas test -sysparm'title ''a'';' > > > > nber6%> sas test -sysparm'title \"a\";' > > > > > All fail with the same error (to the console, no log is produced and > > > > the contents of test.sas don't affect the message): > > > > > BTW, the "title" command is chosen strictly to motivate the question, > > > > there is more going on in my actual application to justify the need > > > > for quote marks. > > > > > ERROR: Invalid file, /home/feenberg/a;.sas. > > > > > This one fails with a different message: > > > > > nber6%> sas test -sysparm'title \'a\';' > > > > Unmatched ' > > > > > Is there a way? > > > > > DanielFeenberg > > > > NBER > > > > > ERROR: Invalid file, /disk/homes2c/nber/feenberg/taxcalc/\"a\";.sas.. > > > > I think the problem order. -SYSPARMshould be before TEST > > > > I tested > > > > sas -sysparm'title "a";' test.sas > > > > and it work as expected. resolving SYSPARMproduced a valid title > > > statement. > > > Maybe you have a more recent version of SAS. I have 9.1 and it doesn't > > work. > > Well, if I put "test" last, it helps to the extent that I now get a > > logfile, but the l > > ogfile shows &SYSPARM without substituting the title statement. > > > This isn't solely because of the quotes because I can't get blanks > > intoSYSPARM. > > either. For example, take a complete sas program: > > > &SYSPARM; > > endsas; > > > and invoke it with: > > > sas -SYSPARM"proc options" test > > > The log file comes back with the message: > > 1 &SYSPARM; > > _ 10 > > ERROR 10-205: Expecting the name of the procedure to be executed. > > 2 endsas; > > > From the text of the error message I understand that SAS stopped > > parsing > > at the space before the word "options" - soSYSPARMneeds to be a > > single > > word. I get the same result for single quotes or just escaping the > > space. Anyway, > > it looks like theSYSPARMparamter is not going to let me insert words > > into > > a title statement. It is clumsy, but I guess I can use %INCLUDE > > instead. > > > DanielFeenberg- Hide quoted text - > > > - Show quoted text - Yes, that is it. Thanks for the insight! In csh the wildcard is "$*", though. Daniel Feenberg |