<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73381#M15809</link>
    <description>It looks like:&lt;BR /&gt;
1- Macro variables don't like storing non-printable characters.&lt;BR /&gt;
2- SQL in V9.1 doesn't like a missing 2nd parameter in the compress function&lt;BR /&gt;
3- Even if the 2nd parameter is not missing, the 3rd parameter 'c' is not honoured in SQL V9.1&lt;BR /&gt;
&lt;BR /&gt;
So you must store hex values instead of actual values in your macro variable.&lt;BR /&gt;
You can do this with a data step or with a macro:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  length TXT $64;&lt;BR /&gt;
  do I=0 to 31;&lt;BR /&gt;
    TXT=put(I,hex2.)||TXT;&lt;BR /&gt;
  end;&lt;BR /&gt;
  call symput('CTRL_CHAR1',TXT);  &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%macro concat_ctrl;&lt;BR /&gt;
  %global CTRL_CHAR2;&lt;BR /&gt;
  %do i=0 %to 31;&lt;BR /&gt;
    %let CTRL_CHAR2=&amp;amp;CTRL_CHAR2%sysfunc(putn(&amp;amp;i,hex2.));&lt;BR /&gt;
  %end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%concat_ctrl;&lt;BR /&gt;
&lt;BR /&gt;
ods html;&lt;BR /&gt;
proc sql;  * '21'x is the ! character;&lt;BR /&gt;
  select compress('210A21'x, "&amp;amp;CTRL_CHAR1"x) as GOOD_DATA_VAR from sashelp.class(obs=1);&lt;BR /&gt;
  select compress('210A21'x, "&amp;amp;CTRL_CHAR2"x) as GOOD_MACRO_VAR from sashelp.class(obs=1);&lt;BR /&gt;
  select compress('210A21'x, ' ','c') as BAD_C_PARAM from sashelp.class(obs=1);&lt;BR /&gt;
quit;&lt;BR /&gt;
data TEST;&lt;BR /&gt;
  GOOD_C_PARAM=compress('210A21'x, , 'c');&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
yields (note how the non-printable character 0A (in the middle) is still in the 3rd output):&lt;BR /&gt;
[pre]&lt;BR /&gt;
GOOD_DATA_VAR &lt;BR /&gt;
!! &lt;BR /&gt;
&lt;BR /&gt;
GOOD_MACRO_VAR &lt;BR /&gt;
!! &lt;BR /&gt;
&lt;BR /&gt;
BAD_C_PARAM &lt;BR /&gt;
! ! &lt;BR /&gt;
&lt;BR /&gt;
GOOD_C_PARAM &lt;BR /&gt;
!! &lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
    <pubDate>Thu, 08 Apr 2010 23:30:25 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2010-04-08T23:30:25Z</dc:date>
    <item>
      <title>Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73376#M15804</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I thought of using the compress function with modifier inside the PROC SQL, but it isn't allowed, The expression "Compress(CRED_CUST_No, ,'c')" been used in the ETL mapping itself, so DI generates the proc SQL, and PROC SQL isn't allowing the modifier as part of the COMPRESS function.&lt;BR /&gt;
&lt;BR /&gt;
you may refer the log below...&lt;BR /&gt;
&lt;BR /&gt;
2857 proc sql;&lt;BR /&gt;
2858 create table work.W5TR1SOO as&lt;BR /&gt;
2859 select BS_MANDATE_NO length = 6,&lt;BR /&gt;
2860 CRED_CG_ID length = 6,&lt;BR /&gt;
2861 (COMPRESS(CRED_CUST_NO, ,'c')) as CRED_CUST_NO length = 32 informat = $ebcdic32.,&lt;BR /&gt;
_&lt;BR /&gt;
22&lt;BR /&gt;
&lt;BR /&gt;
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, &lt;BR /&gt;
a missing value, BTRIM, INPUT, LOWER, PUT, SUBSTRING, UPPER, USER.&lt;BR /&gt;
&lt;BR /&gt;
Workaround for the above is using Compress function with the DATA STEP processing by customizing the pre generated source code.&lt;BR /&gt;
&lt;BR /&gt;
Any other work around to eliminate the control characters using PROC SQL? so I can stop customizing the SAS transformation.&lt;BR /&gt;
&lt;BR /&gt;
Thanks and Regards,&lt;BR /&gt;
AnjiREDDY.</description>
      <pubDate>Mon, 05 Apr 2010 05:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73376#M15804</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-05T05:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73377#M15805</link>
      <description>This code run with PC SAS 9.22 works fine for me.&lt;BR /&gt;
&lt;BR /&gt;
data have;&lt;BR /&gt;
  var=cats('1','0A'x,'0D'x,'2');&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
  select &lt;BR /&gt;
    var, &lt;BR /&gt;
    compress(var,,'c') as  cvar  length = 32 informat = $ebcdic32.&lt;BR /&gt;
    from have&lt;BR /&gt;
  ;&lt;BR /&gt;
quit;</description>
      <pubDate>Mon, 05 Apr 2010 07:17:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73377#M15805</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-04-05T07:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73378#M15806</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
You may be right, in the SAS version 9.2 you might be able to use compress function with modifiers in proc sql, unfortunately we are still using 9.1.3.4, our SAS is yet to be upgraded to 9.2. PROC SQL isn't allowing us to use compress fucntion with modifier as I posted above, but we are able to use the same in data step processing.&lt;BR /&gt;
&lt;BR /&gt;
Could you please help me to write the sql query to ignore those control characters?&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
AnjiReddy.</description>
      <pubDate>Mon, 05 Apr 2010 08:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73378#M15806</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-05T08:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73379#M15807</link>
      <description>You can code the 2nd argument as an explicit list of characters to compress out, and omit the third argument altogether.  Use the concatenation operator and create a string to list your characters.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS 9 Language Dictionary, Function and CALL Routines&lt;BR /&gt;
COMPRESS Function&lt;BR /&gt;
Removes specific characters from a character string &lt;BR /&gt;
&lt;A href="http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212246.htm" target="_blank"&gt;http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212246.htm&lt;/A&gt;</description>
      <pubDate>Mon, 05 Apr 2010 11:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73379#M15807</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-04-05T11:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73380#M15808</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
As you advised, I have been trying to concatenate the control characters into a string but it throws an error when I tried to invoke the macro function below&lt;BR /&gt;
&lt;BR /&gt;
%macro concat_ctrl(contstr=,i=);&lt;BR /&gt;
      %do %while(&amp;amp;i &amp;lt; 32);&lt;BR /&gt;
   	%let contstr = %sysfunc(cats(&amp;amp;contstr,%sysfunc(byte(&amp;amp;i))));&lt;BR /&gt;
	%put &amp;amp;contstr &amp;amp;i;&lt;BR /&gt;
	%let i=%eval(&amp;amp;i+1);&lt;BR /&gt;
      %end;&lt;BR /&gt;
%mend concat_ctrl;&lt;BR /&gt;
%concat_ctrl(contstr=%sysfunc(byte(0)), i=1);&lt;BR /&gt;
&lt;BR /&gt;
You may refer the log below&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Beginning execution.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Parameter CONTSTR has value &lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Parameter I has value 1&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 1&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 32) loop beginning; condition is TRUE.  &lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 1&lt;BR /&gt;
ERROR: %SYSEVALF function has no expression to evaluate.&lt;BR /&gt;
ERROR: %SYSEVALF function has no expression to evaluate.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 1&lt;BR /&gt;
1&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 1&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 2&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 32) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 2&lt;BR /&gt;
ERROR: %SYSEVALF function has no expression to evaluate.&lt;BR /&gt;
ERROR: %SYSEVALF function has no expression to evaluate.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 2&lt;BR /&gt;
2&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 2&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 3&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 32) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 3&lt;BR /&gt;
ERROR: Expected close parenthesis after macro function invocation not found.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 3&lt;BR /&gt;
3&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 3&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 4&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 32) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 4&lt;BR /&gt;
ERROR: Expected close parenthesis after macro function invocation not found.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to &lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 4&lt;BR /&gt;
&lt;BR /&gt;
But I am able to invoke the macro function above with difference values&lt;BR /&gt;
&lt;BR /&gt;
%macro concat_ctrl(contstr=,i=);&lt;BR /&gt;
      %do %while(&amp;amp;i &amp;lt; 72);&lt;BR /&gt;
   	%let contstr = %sysfunc(cats(&amp;amp;contstr,%sysfunc(byte(&amp;amp;i))));&lt;BR /&gt;
	%put &amp;amp;contstr &amp;amp;i;&lt;BR /&gt;
	%let i=%eval(&amp;amp;i+1);&lt;BR /&gt;
      %end;&lt;BR /&gt;
%mend concat_ctrl;&lt;BR /&gt;
%concat_ctrl(contstr=%sysfunc(byte(65)), i=66);&lt;BR /&gt;
&lt;BR /&gt;
You may refer the log below&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Beginning execution.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Parameter CONTSTR has value A&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Parameter I has value 66&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 66&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 72) loop beginning; condition is TRUE.  &lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to A&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 66&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to AB&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 66&lt;BR /&gt;
AB 66&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 66&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 67&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 72) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to AB&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 67&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABC&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 67&lt;BR /&gt;
ABC 67&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 67&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 68&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 72) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABC&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 68&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCD&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 68&lt;BR /&gt;
ABCD 68&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 68&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 69&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 72) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCD&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 69&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCDE&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 69&lt;BR /&gt;
ABCDE 69&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 69&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 70&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 72) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
48                                                         The SAS System                             07:55 Wednesday, April 7, 2010&lt;BR /&gt;
&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCDE&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 70&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCDEF&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 70&lt;BR /&gt;
ABCDEF 70&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 70&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 71&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE(&amp;amp;i &amp;lt; 72) condition is TRUE; loop will  iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is CONTSTR)&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCDEF&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 71&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %PUT &amp;amp;contstr &amp;amp;i&lt;BR /&gt;
SYMBOLGEN:  Macro variable CONTSTR resolves to ABCDEFG&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 71&lt;BR /&gt;
ABCDEFG 71&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %LET (variable name is I)&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 71&lt;BR /&gt;
SYMBOLGEN:  Macro variable I resolves to 72&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  %DO %WHILE() condition is FALSE; loop will not iterate again.&lt;BR /&gt;
MLOGIC(CONCAT_CTRL):  Ending execution.&lt;BR /&gt;
&lt;BR /&gt;
&lt;B&gt;Could you please correct me to concatenate the control characters into a string?&lt;/B&gt;&lt;BR /&gt;
&lt;BR /&gt;
Thanks and Regards,&lt;BR /&gt;
AnjiReddy.

Message was edited by: Reddy1729</description>
      <pubDate>Wed, 07 Apr 2010 06:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73380#M15808</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-07T06:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73381#M15809</link>
      <description>It looks like:&lt;BR /&gt;
1- Macro variables don't like storing non-printable characters.&lt;BR /&gt;
2- SQL in V9.1 doesn't like a missing 2nd parameter in the compress function&lt;BR /&gt;
3- Even if the 2nd parameter is not missing, the 3rd parameter 'c' is not honoured in SQL V9.1&lt;BR /&gt;
&lt;BR /&gt;
So you must store hex values instead of actual values in your macro variable.&lt;BR /&gt;
You can do this with a data step or with a macro:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  length TXT $64;&lt;BR /&gt;
  do I=0 to 31;&lt;BR /&gt;
    TXT=put(I,hex2.)||TXT;&lt;BR /&gt;
  end;&lt;BR /&gt;
  call symput('CTRL_CHAR1',TXT);  &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%macro concat_ctrl;&lt;BR /&gt;
  %global CTRL_CHAR2;&lt;BR /&gt;
  %do i=0 %to 31;&lt;BR /&gt;
    %let CTRL_CHAR2=&amp;amp;CTRL_CHAR2%sysfunc(putn(&amp;amp;i,hex2.));&lt;BR /&gt;
  %end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%concat_ctrl;&lt;BR /&gt;
&lt;BR /&gt;
ods html;&lt;BR /&gt;
proc sql;  * '21'x is the ! character;&lt;BR /&gt;
  select compress('210A21'x, "&amp;amp;CTRL_CHAR1"x) as GOOD_DATA_VAR from sashelp.class(obs=1);&lt;BR /&gt;
  select compress('210A21'x, "&amp;amp;CTRL_CHAR2"x) as GOOD_MACRO_VAR from sashelp.class(obs=1);&lt;BR /&gt;
  select compress('210A21'x, ' ','c') as BAD_C_PARAM from sashelp.class(obs=1);&lt;BR /&gt;
quit;&lt;BR /&gt;
data TEST;&lt;BR /&gt;
  GOOD_C_PARAM=compress('210A21'x, , 'c');&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
run;&lt;BR /&gt;
ods html close;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
yields (note how the non-printable character 0A (in the middle) is still in the 3rd output):&lt;BR /&gt;
[pre]&lt;BR /&gt;
GOOD_DATA_VAR &lt;BR /&gt;
!! &lt;BR /&gt;
&lt;BR /&gt;
GOOD_MACRO_VAR &lt;BR /&gt;
!! &lt;BR /&gt;
&lt;BR /&gt;
BAD_C_PARAM &lt;BR /&gt;
! ! &lt;BR /&gt;
&lt;BR /&gt;
GOOD_C_PARAM &lt;BR /&gt;
!! &lt;BR /&gt;
&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 08 Apr 2010 23:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73381#M15809</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2010-04-08T23:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73382#M15810</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thank a lot for posting the resoltuion to the issue which I have.&lt;BR /&gt;
&lt;BR /&gt;
I have used the expression compress('Var1',' ','c') in proc sql and verified the data, it eliminates all the control characters. Can I goahead with this?&lt;BR /&gt;
&lt;BR /&gt;
Kindly advise.&lt;BR /&gt;
&lt;BR /&gt;
Thanks and Regards,&lt;BR /&gt;
AnjiReddy.</description>
      <pubDate>Fri, 09 Apr 2010 08:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73382#M15810</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-09T08:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73383#M15811</link>
      <description>If control characters are gone, by all means go ahead. Which version of sas are you using?</description>
      <pubDate>Fri, 09 Apr 2010 21:27:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73383#M15811</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2010-04-09T21:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using COMPRESS function inside a PROC SQL with modifiers isn't allowed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73384#M15812</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
Thanx a ton for your promptive responses.&lt;BR /&gt;
&lt;BR /&gt;
As you said using compress function with 'c' as the third argument isn't honoured in proc sql. When I verified last time, my test data didn't have special characters, when I included special characters in the input data, I found that it isn't working properly.&lt;BR /&gt;
so read the data as hexadecimal and invoked the macro function that you specified above and then derived a good macro variable in proc sql as you specified above &lt;BR /&gt;
&lt;BR /&gt;
Thanks and Regards,&lt;BR /&gt;
AnjiReddy.</description>
      <pubDate>Mon, 12 Apr 2010 11:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-COMPRESS-function-inside-a-PROC-SQL-with-modifiers-isn-t/m-p/73384#M15812</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-04-12T11:33:05Z</dc:date>
    </item>
  </channel>
</rss>

