<?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: Output statement to bucket the data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868919#M343265</link>
    <description>&lt;PRE&gt;If member in ("A", "B) and code = "T" and payer in ("V") then do;&lt;BR /&gt;   thisfield = "CCC";&lt;BR /&gt;   output;&lt;BR /&gt;end;&lt;/PRE&gt;
&lt;P&gt;If you are asking to conditionally output only after setting thisfield, you would do it as above.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Apr 2023 19:34:08 GMT</pubDate>
    <dc:creator>WarrenKuhfeld</dc:creator>
    <dc:date>2023-04-10T19:34:08Z</dc:date>
    <item>
      <title>Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868916#M343262</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I have a code like this:&lt;/P&gt;
&lt;PRE&gt;If member in ("A", "B) and code = "T" and payer in ("V") then thisfield = "CCC"&lt;/PRE&gt;
&lt;P&gt;I want to use output statement to bucket it right after the statement is read. I can say:&lt;/P&gt;
&lt;P&gt;How can I use output statement? How can I use thisfield along with output statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Respectfully,&lt;/P&gt;
&lt;P&gt;CloudsInSky&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 19:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868916#M343262</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-10T19:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868917#M343263</link>
      <description>&lt;P&gt;I don't really understand the question. Bucketing the data and the OUTPUT statement are relatively independent.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I want to use output statement to bucket it right after the statement is read.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So what is stopping you?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 19:27:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868917#M343263</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-04-10T19:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868918#M343264</link>
      <description>&lt;P&gt;You can use the OUTPUT statement anywhere in a DATA step.&amp;nbsp; So could could do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  If member in ("A", "B) and code = "T" and payer in ("V") then thisfield = "CCC" ;
  output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But that step would give you the same output data without the OUTPUT statement, because the DATA step has an implied OUTPUT statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you could show a bit more of what you are trying to do.&amp;nbsp; You could post code to create a dataset with a few records of example data, and then show the dataset you would like to create from that example data, and the code you have tried.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 19:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868918#M343264</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-04-10T19:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868919#M343265</link>
      <description>&lt;PRE&gt;If member in ("A", "B) and code = "T" and payer in ("V") then do;&lt;BR /&gt;   thisfield = "CCC";&lt;BR /&gt;   output;&lt;BR /&gt;end;&lt;/PRE&gt;
&lt;P&gt;If you are asking to conditionally output only after setting thisfield, you would do it as above.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 19:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868919#M343265</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2023-04-10T19:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868925#M343267</link>
      <description>&lt;P&gt;One more tip I'll add in addition to the good advice provided so far. You can use DATA step to create multiple output data sets in one step, and use conditional OUTPUT statements to control what goes into each. This example creates one data set (WANT1) with your "CCC" records, and a second data set (WANT2) with all other records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;data want1 want2;
set have;
If member in ("A", "B) and code = "T" and payer in ("V") then do;
   thisfield = "CCC";
   output want1;
end;
else output want2;
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 19:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868925#M343267</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2023-04-10T19:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868960#M343278</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want this output (want1) to be value for a variable such as productName.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;productName =want1&lt;BR /&gt;prouctName = want2&lt;BR /&gt;an so on.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;I appreciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Blue Blue&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2023 22:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868960#M343278</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-10T22:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868966#M343281</link>
      <description>&lt;P&gt;Hello team member,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is what I want and I got it.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test1;
set sashelp.class;
format item $8.;
run;

data test2;
set test1;
if Name = "Alfred" then output = "AA";
If Name = "Alice" then output = "BB";
item = Output;
Run;


This gave me what I needed.&lt;BR /&gt;Thanks,&lt;BR /&gt;blueblue &lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Apr 2023 23:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868966#M343281</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-10T23:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868984#M343285</link>
      <description>&lt;P&gt;Hello team;&lt;/P&gt;
&lt;PRE&gt;If member in ("A", "B) and code = "T" and payer in ("V") then do;&lt;BR /&gt;   thisfield = "CCC";&lt;BR /&gt;   output;&lt;BR /&gt;end;&lt;/PRE&gt;
&lt;P&gt;This syntax gives errors:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR 117-185: There were 8 unclosed DO blocks.
&lt;/PRE&gt;
&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;Blue Blue&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 04:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868984#M343285</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-11T04:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868988#M343287</link>
      <description>&lt;P&gt;Hello Chris,&lt;/P&gt;
&lt;PRE&gt;data want1 want2;
set have;
If member in ("A", "B) and code = "T" and payer in ("V") then do;
   thisfield = "CCC";
   output want1;
end;
else output want2;
run;&lt;/PRE&gt;
&lt;P&gt;I have more than two if statements. I have 8 if statements. How can I place them in "if and else statements. Instead of data want1, want2, I have want1, want2, want3, want4, want5, want6, want7, want8.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 04:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/868988#M343287</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-11T04:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869004#M343294</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if /* condition */
then do;
  /* action */
end;
else if /* another condition */
then do;
  /* another action */
end;
/* and so on */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2023 06:08:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869004#M343294</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-11T06:08:46Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869148#M343329</link>
      <description>Hello,&lt;BR /&gt;Thank you so very much for the response. What would be the last statement ? Else if or else? &lt;BR /&gt;Respectfully &lt;BR /&gt;Blue blue</description>
      <pubDate>Tue, 11 Apr 2023 16:43:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869148#M343329</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-11T16:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869149#M343330</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/" target="_blank"&gt;https://blogs.sas.com/content/sasdummy/2015/01/26/how-to-split-one-data-set-into-many/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869149#M343330</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-04-11T16:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869157#M343334</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/202329"&gt;@GN0001&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hello,&lt;BR /&gt;Thank you so very much for the response. What would be the last statement ? Else if or else? &lt;BR /&gt;Respectfully &lt;BR /&gt;Blue blue&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It's up to you to decide, as the programmer.&amp;nbsp; Personally, if I write IF/ELSE IF blocks, I like to explicitly handle all the expected scenarios with ELSE IF statements.&amp;nbsp; Then I add an ELSE statement which generates an error message if the data have any surprises.&amp;nbsp; e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if var='A' then do ;
  *...;
end;
else if var='B' then do ;
  *...;
end;
else if var='C' then do ;  /*else if statements for every expected value*/
  *...;
end;
else do;
  put "ER" "ROR: unexpected value " var= ;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;that allows your code to detect any records that fall through gaps in the logic.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 17:03:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869157#M343334</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-04-11T17:03:15Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869173#M343346</link>
      <description>&lt;P&gt;This depends on the logic you want to implement in your code, so it's up to you.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 18:47:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869173#M343346</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-04-11T18:47:52Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869218#M343360</link>
      <description>Hello, &lt;BR /&gt;I am going to output observations conditionally. I am not creating a dataset output. &lt;BR /&gt;Regards. &lt;BR /&gt;Blue &amp;amp; blue</description>
      <pubDate>Tue, 11 Apr 2023 22:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869218#M343360</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-11T22:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Output statement to bucket the data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869219#M343361</link>
      <description>I am outpouring observations only not a dataset.&lt;BR /&gt;Thanks,&lt;BR /&gt;Blu blue</description>
      <pubDate>Tue, 11 Apr 2023 22:03:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Output-statement-to-bucket-the-data/m-p/869219#M343361</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2023-04-11T22:03:22Z</dc:date>
    </item>
  </channel>
</rss>

