<?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 Variable due to some of the rows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841315#M332649</link>
    <description>&lt;P&gt;Hi!&amp;nbsp;&lt;SPAN&gt;I create a dataset with a variable ID from 1 to 22. I want to give a new variable called "twins" the value 1 for just object 20 (all other objekts I do want to have the value 0 for that new variable) if both objects with ID 21 and 22 is on the file othervise 0. How do I do that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Oct 2022 15:04:55 GMT</pubDate>
    <dc:creator>SAS-programmer</dc:creator>
    <dc:date>2022-10-28T15:04:55Z</dc:date>
    <item>
      <title>Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841315#M332649</link>
      <description>&lt;P&gt;Hi!&amp;nbsp;&lt;SPAN&gt;I create a dataset with a variable ID from 1 to 22. I want to give a new variable called "twins" the value 1 for just object 20 (all other objekts I do want to have the value 0 for that new variable) if both objects with ID 21 and 22 is on the file othervise 0. How do I do that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841315#M332649</guid>
      <dc:creator>SAS-programmer</dc:creator>
      <dc:date>2022-10-28T15:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841319#M332652</link>
      <description>&lt;P&gt;I'm not understanding. I thought I understood this part: "&lt;SPAN&gt;I create a dataset with a variable ID from 1 to 22. I want to give a new variable called "twins" the value 1 for just object 20 (all other objekts I do want to have the value 0 for that new variable)" but then this part confused me totally: "...if both objects with ID 21 and 22 is on the file othervise 0."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please show us the original data set, and the desired result.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841319#M332652</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-28T15:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841328#M332659</link>
      <description>Hi!&lt;BR /&gt;I randomly create this type of file by chosing 5 objects of 22.&lt;BR /&gt;[cid:image001.png@01D8EAF6.31F98480]&lt;BR /&gt;I want to add a new row with ID=20 and in the case I recieve both number 21 and 22 I want to give a new variable the value 1 for ID=20 otherwise 0.&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Oct 2022 15:53:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841328#M332659</guid>
      <dc:creator>SAS-programmer</dc:creator>
      <dc:date>2022-10-28T15:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841332#M332662</link>
      <description>&lt;P&gt;I still don't understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us the input data set and the desired output.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 16:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841332#M332662</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-28T16:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841333#M332663</link>
      <description>&lt;P&gt;And do&amp;nbsp;&lt;STRONG&gt;NOT&lt;/STRONG&gt; post data in pictures. Post data as text, ideally as a DATA step with DATALINES which recreates your dataset successfully when submitted.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 16:15:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841333#M332663</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-28T16:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841348#M332674</link>
      <description>&lt;P&gt;I think you're mixing up two variables which is what is making this confusing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my interpretation of your problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*data of random objects you do have;
data have;
do object=1 to 25;
output;
end;
run;

*randomly select 22;
proc surveyselect data=have out=selected  method=srs sampsize=22 seed=245;
run;

*add in an id for each row;
data selected;
set selected;
id=_n_;
run;

*check if you have the 21 and 22 observations;
%let countobs=0;

proc sql;
create table temp as
select *
from selected where object in (21, 22);
quit;

%let countobs=&amp;amp;sqlobs;

*if observations are present add the flag;
data want;
set selected;
twins=0;
if id=20 and &amp;amp;countobs=2 then twins=1;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this is incorrect, please show sample input data and expected output, similar to what I have posted above.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2022 16:51:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841348#M332674</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-28T16:51:52Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841438#M332720</link>
      <description>My dataset Population looks like this:&lt;BR /&gt;[cid:image003.png@01D8EB95.9119C7F0]&lt;BR /&gt;And one example of my repeated samples drawn from Population looks like this and the dataset is called Sample:&lt;BR /&gt;[cid:image002.png@01D8EB94.BE8CB810]&lt;BR /&gt;Now I want in a third dataset Counter count two things. First how many times a certain object is drawn. And also how many times both ID 21 and 22 is both drawn.&lt;BR /&gt;In this case I want&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Oct 2022 10:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841438#M332720</guid>
      <dc:creator>SAS-programmer</dc:creator>
      <dc:date>2022-10-29T10:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Variable due to some of the rows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841439#M332721</link>
      <description>&lt;P&gt;Not only do your pictures not appear, you have ignored what you were told earlier by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;: "do&amp;nbsp;&lt;STRONG&gt;NOT&lt;/STRONG&gt; post data in pictures. Post data as text, ideally as a DATA step with DATALINES which recreates your dataset successfully when submitted." We'd like to help you, but you have to help us too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2022 11:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Variable-due-to-some-of-the-rows/m-p/841439#M332721</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-29T11:20:15Z</dc:date>
    </item>
  </channel>
</rss>

