<?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: sas programming in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899121#M355391</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/455950"&gt;@Satora_In&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I asked for a solution&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And did not describe the problem(s). " I can’t do it." especially without a description of the code is supposed to do makes it pretty hard to recognize a solution.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2023 14:17:41 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-10-18T14:17:41Z</dc:date>
    <item>
      <title>sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899071#M355374</link>
      <description>&lt;DIV&gt;Dear guys,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I upload a different number of columns every day and I want to write a script so that the macro accepts columns regardless of the number. I wrote a request and I can’t do it. help me please&lt;BR /&gt;&lt;BR /&gt;%_eg_conditional_dropds(WORK.QUERY_FOR_TRNSTRANSPOSED_0000);&lt;/DIV&gt;&lt;DIV&gt;%macro dynamic_query(input_table, output_table);&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let column_list =&amp;nbsp; TELEPHONE1, ZAKAZ_NUMBER;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%do i = 3 %to 100;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let column_list = &amp;amp;column_list, STOLOBC&amp;amp;i;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%end;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;proc sql;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;create table %output_table as&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;select distinct %column_list,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;catx(";", %do j = 1 %to 100;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%if j ne 1 %then %do; %end;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;input(put(STOLOBC&amp;amp;j, BEST11.), $FREE11.)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%end&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;) AS SKU&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FROM &amp;amp;input_table;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;quit;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%mend;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%dynamic_query(work.trnstransposed, work.query);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;PROC SQL;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;CREATE TABLE WORK.QUERY_FOR_TRNSTRANSPOSED_0000 AS&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;SELECT DISTINCT t1.TELEPHONE1 AS TELEPHONE1,&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t1.ZAKAZ_NUMBER AS ZAKAZ_NUMBER,&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /* SKU */&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; LENGHT 280&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AS SKU&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; FROM WORK.TRNSTRANSPOSED t1;&lt;/DIV&gt;&lt;DIV&gt;QUIT;&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Oct 2023 08:56:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899071#M355374</guid>
      <dc:creator>Satora_In</dc:creator>
      <dc:date>2023-10-18T08:56:14Z</dc:date>
    </item>
    <item>
      <title>better subject line needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899076#M355376</link>
      <description>&lt;P&gt;We're going to try to help you, but you need to help us as well. Please go back to your ORIGINAL post and change the subject line so that it is a brief but meaningful description of the problem. A subject line that says "sas programming" could be used on every message, but it is not meaningful and not descriptive. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 10:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899076#M355376</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-18T10:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899087#M355380</link>
      <description>&lt;P&gt;An advice recommended many times: always start without any macro statements and variables. Test the code, then wrap it into a macro, and replace the things that need to be dynamic, one after the other, with a test between each modification.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 11:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899087#M355380</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-10-18T11:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899091#M355382</link>
      <description>&lt;P&gt;"Can't do it" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "&amp;lt;/&amp;gt;" icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since your code involves a macro you should set the system option MPRINT before executing the macro so the Log will have details of the code generated.&lt;/P&gt;
&lt;PRE&gt;options mprint;

%dynamic_query(work.trnstransposed, work.query);

options nomprint; /* turn off the option*/&lt;/PRE&gt;
&lt;P&gt;Since you are using a custom informat, $Free, you may need to include the definition of that as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This defines a string containing values that start at Stolobc3 to 100&lt;/P&gt;
&lt;PRE&gt;%do i = 3 %to 100;
%let column_list = &amp;amp;column_list, STOLOBC&amp;amp;i;
%end;&lt;/PRE&gt;
&lt;PRE&gt;i=3  column_list= TELEPHONE1, ZAKAZ_NUMBER, STOLOBC3
&lt;/PRE&gt;
&lt;P&gt;Then here you use STOLOBC2. So I suspect something doesn't quite align.&lt;/P&gt;
&lt;PRE&gt;%do j = 1 %to 100;
%if j ne 1 %then %do; %end;
input(put(STOLOBC&amp;amp;j, BEST11.), $FREE11.)
%end&lt;/PRE&gt;
&lt;P&gt;That input expects 99 different variables to already exist in the set &amp;amp;input_table. How sure are you of all of those variables already existing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You state that you want to "upload" (whatever that means) a "different number of columns". I don't see any attempt deal with different number of "columns" (SAS terminology is usually variables) just one long semicolon delimited value called SKU&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input(put(STOLOBC&amp;amp;j, BEST11.), $FREE11.)&amp;nbsp; will right justify the results of the Put which means the result will have leading spaces when fewer than 11 print positions get used by BEST (&amp;nbsp; if the value is 5 result is "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5") so if your Informat does not define what to do with leading spaces your output from the Input function is going to be suspect.&lt;/P&gt;
&lt;P&gt;This may want&lt;/P&gt;
&lt;P&gt;input(put(STOLOBC&amp;amp;j, BEST11. -L), $FREE11.)&lt;/P&gt;
&lt;P&gt;The -L says to left justify the result. So there won't be leading spaces.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've never used Catx quite the way you have. Normally without a defined length for the resulting variable I would expect the result to be truncated to 200 characters but sometimes Proc SQL does stuff I don't expect. If your results of the $free informat are 2 characters the resulting catx would be 296 characters long (99*3 -1&amp;nbsp; for the last value not having the ; following).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A description of what you think this is supposed to be wold be nice as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 11:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899091#M355382</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-18T11:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899092#M355383</link>
      <description>&lt;P&gt;I asked for a solution&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 11:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899092#M355383</guid>
      <dc:creator>Satora_In</dc:creator>
      <dc:date>2023-10-18T11:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899109#M355389</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/455950"&gt;@Satora_In&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I asked for a solution&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So show us the &lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;working&lt;/STRONG&gt; &lt;/FONT&gt;code for one or two iterations without macros and without macro variables first, as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;said, and we can probably help you turn this into a macro. We need you to provide information, we ask for specific information; and we can't do it without that information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And of course, provide a meaningful subject line in your ORIGINAL post.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 13:02:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899109#M355389</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-10-18T13:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899121#M355391</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/455950"&gt;@Satora_In&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I asked for a solution&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And did not describe the problem(s). " I can’t do it." especially without a description of the code is supposed to do makes it pretty hard to recognize a solution.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 14:17:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899121#M355391</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-18T14:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899165#M355399</link>
      <description>E PROC SQL;&lt;BR /&gt;CREATE TABLE WORK. QUERY FOR TRNSTRANSPOSED 0000 AS SELECT DISTINCT t1. TELEPHONE1 AS TELEPHONE1, t1. ZARAZ NUMBER AS ZAKAZ NUMBER,&lt;BR /&gt;/w gRit W&lt;BR /&gt;(catx (;' input (put (t1. "Столбец1 'n, BEST11. ), $FREEl1. ) , input (put (t1. "Столбец2'n, BEST11. ), $FREE11.&lt;BR /&gt;input (put (+1. 'Столбец3'п,&lt;BR /&gt;BEST11. ),$FREE11. ), input (put (t1. 'Столбец4 'n, BEST11. ), $FREE11. ) , input (put (t1.&lt;BR /&gt;"Столбец5 'n, BEST11. ), SFREE11.&lt;BR /&gt;input (put (t1. 'Столбец6'n. BEST11 ),$FREE1Í. ) , input (put (+1. 'Столбец7 'n, BEST11. ),$FREE11. ) , input (put (t1.&lt;BR /&gt;"Столбец8 'n, BEST11. ) ,$FREE11.)&lt;BR /&gt;input (put (t1. 'Столбец4'n, BEST11&lt;BR /&gt;) , $FREE11. ) , input (put (t1. 'Столбец4'n, BEST11. ), $FREE11. ), input (put (t1.&lt;BR /&gt;"Столбец4 'n, BEST11. ), $FREE11&lt;BR /&gt;input (put (t1. 'Столбец4 'n, BEST11. ), $FREE11. ) , input (put (t1. 'Столбец9'n, BEST11. ),$FREE11. ), input (put (t1&lt;BR /&gt;"Столбец10'n, BEST11.&lt;BR /&gt;) , $FREE11.)&lt;BR /&gt;input (put (t1. 'Столбец11'n,&lt;BR /&gt;BEST11&lt;BR /&gt;) "SFREE11. ), input (put (t1. "Столбец12 'n, BEST11. ), $FREE11.&lt;BR /&gt;) , input (put (t1. 'Столбец13'n, BEST11. ) , SFREE11.) input (put (t1. 'Столбец14'n, BEST11 . ) , $PREE11.) , input (put (t1. "Столбец15'n, BEST11. ) , $FREE11.&lt;BR /&gt;) , input (put (+1. "Столбец16'n, BEST11. ),$FREE11&lt;BR /&gt;,input (put (t1. 'Столбец17'n, BEST11&lt;BR /&gt;) , $FREE11. ) , input (put (t1. 'Столбец18'n, BEST11. ), $FREE11.&lt;BR /&gt;) ,input (put (t1. 'Столбец19'n, BEST11. ), $FREE11. ).&lt;BR /&gt;input (put (t1. 'Столбец20 "n, BEST11. ), SFREE11. ), input (put (t1. 'Сполбец21'n, BEST11. ), $FREE11.&lt;BR /&gt;) , input (put (t1. 'Столбец22'n, BEST11. ),$FREE11. ).&lt;BR /&gt;input (put (t1. 'Столбец23'n, BEST11. ), $FREE11. ), input (put (ti. "Столбец24'n, BEST11. ), $FREE11.&lt;BR /&gt;) , input (put (t1. 'Столбец25 'n, BEST11. ), $FREE11.&lt;BR /&gt;input (put (t1. 'Столбец26'n, BEST11.&lt;BR /&gt;).&lt;BR /&gt;) ,$FREE11. ),input (put (t1. 'Столбец27'n, BEST11. ), $FREE11. )))&lt;BR /&gt;LENGTH=280 AS SKU&lt;BR /&gt;FROM WORK.TRNSTRANSPOSED t1;&lt;BR /&gt;QUIT;&lt;BR /&gt;&lt;BR /&gt;This code is working. I want it to always create a different number of columns</description>
      <pubDate>Wed, 18 Oct 2023 19:13:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899165#M355399</guid>
      <dc:creator>Satora_In</dc:creator>
      <dc:date>2023-10-18T19:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899598#M355567</link>
      <description>my code works, I want to improve it</description>
      <pubDate>Mon, 23 Oct 2023 06:31:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899598#M355567</guid>
      <dc:creator>Satora_In</dc:creator>
      <dc:date>2023-10-23T06:31:30Z</dc:date>
    </item>
    <item>
      <title>Re: sas programming</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899605#M355568</link>
      <description>&lt;UL&gt;
&lt;LI&gt;What is the purpose of the transposed dataset?&lt;/LI&gt;
&lt;LI&gt;Do the (stupid IMO) name literals result from the use of an ID variable during transposition?&lt;/LI&gt;
&lt;LI&gt;What is the definition of the $FREE informat (show the PROC FORMAT code)?&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 23 Oct 2023 07:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-programming/m-p/899605#M355568</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-23T07:09:31Z</dc:date>
    </item>
  </channel>
</rss>

