<?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: Adding a column with different values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199273#M49814</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear PGStats,&lt;/P&gt;&lt;P&gt;Thanks for your prompt reply.&lt;/P&gt;&lt;P&gt;Here's the example: to create a document for a planned study that contains:&lt;/P&gt;&lt;P&gt;- two schools, 50 boys and 50 girls from each school - total 200 pupils.&lt;/P&gt;&lt;P&gt;- for each group (e.g. school 1, 50 boys) to randomly assign a number and sort. The first 25 pupils get treatment and the next 25 pupils get control. &lt;/P&gt;&lt;P&gt;What I've done is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;do school=1,2; do gender='F','M'; do id=1 to 50; &lt;/P&gt;&lt;P&gt;random=uniform(1);&lt;/P&gt;&lt;P&gt;output; end;end;end;&lt;/P&gt;&lt;P&gt;proc sort; by school gender random;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data b; /*creating a vector of changing group values*/&lt;/P&gt;&lt;P&gt;do temp=1 to 4; do group='C','T'; do temp_1=1 to 25;&lt;/P&gt;&lt;P&gt;drop temp temp_1;&lt;/P&gt;&lt;P&gt;output; end;end;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data all; merge a b;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine, but I was asked to do it in one document without merging an external document (I was given a tip of using count+1).&lt;/P&gt;&lt;P&gt;Do you have an idea how to resolve this?&lt;/P&gt;&lt;P&gt;Tremendous thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 19 Apr 2015 08:16:35 GMT</pubDate>
    <dc:creator>srolash</dc:creator>
    <dc:date>2015-04-19T08:16:35Z</dc:date>
    <item>
      <title>Adding a column with different values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199271#M49812</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I wonder how we add a vector column with different values in the same data-step?&lt;/P&gt;&lt;P&gt;One solution is to create a document with the vector then merge it with the original document. &lt;/P&gt;&lt;P&gt;But, I'm interested to do it in the same document. Any help is extremely appreciable.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Apr 2015 16:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199271#M49812</guid>
      <dc:creator>srolash</dc:creator>
      <dc:date>2015-04-18T16:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a column with different values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199272#M49813</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;Vectors&lt;/EM&gt; and &lt;EM&gt;documents&lt;/EM&gt; are not datastep concepts. As a rule, every variable created in a datastep becomes a variable (or column) in the dataset produced.&lt;/P&gt;&lt;P&gt;Please give an example (Input --&amp;gt; Output) of what you are trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Apr 2015 18:09:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199272#M49813</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-04-18T18:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a column with different values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199273#M49814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear PGStats,&lt;/P&gt;&lt;P&gt;Thanks for your prompt reply.&lt;/P&gt;&lt;P&gt;Here's the example: to create a document for a planned study that contains:&lt;/P&gt;&lt;P&gt;- two schools, 50 boys and 50 girls from each school - total 200 pupils.&lt;/P&gt;&lt;P&gt;- for each group (e.g. school 1, 50 boys) to randomly assign a number and sort. The first 25 pupils get treatment and the next 25 pupils get control. &lt;/P&gt;&lt;P&gt;What I've done is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;do school=1,2; do gender='F','M'; do id=1 to 50; &lt;/P&gt;&lt;P&gt;random=uniform(1);&lt;/P&gt;&lt;P&gt;output; end;end;end;&lt;/P&gt;&lt;P&gt;proc sort; by school gender random;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data b; /*creating a vector of changing group values*/&lt;/P&gt;&lt;P&gt;do temp=1 to 4; do group='C','T'; do temp_1=1 to 25;&lt;/P&gt;&lt;P&gt;drop temp temp_1;&lt;/P&gt;&lt;P&gt;output; end;end;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data all; merge a b;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works fine, but I was asked to do it in one document without merging an external document (I was given a tip of using count+1).&lt;/P&gt;&lt;P&gt;Do you have an idea how to resolve this?&lt;/P&gt;&lt;P&gt;Tremendous thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 08:16:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199273#M49814</guid>
      <dc:creator>srolash</dc:creator>
      <dc:date>2015-04-19T08:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a column with different values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199274#M49815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear PGStat,&lt;/P&gt;&lt;P&gt;Actually, I've just found out the answer has been posted elsewhere, so thanks for your help, really appreciate it.&lt;/P&gt;&lt;P&gt;With all my best,&lt;/P&gt;&lt;P&gt;srolash&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 08:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Adding-a-column-with-different-values/m-p/199274#M49815</guid>
      <dc:creator>srolash</dc:creator>
      <dc:date>2015-04-19T08:32:06Z</dc:date>
    </item>
  </channel>
</rss>

