<?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: Need to create one variable from many in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570155#M160755</link>
    <description>Now the data is coming with count values in visit also... ideally i want to show each visit the count for cat1 and cat2..as i mentioned above data structure</description>
    <pubDate>Mon, 01 Jul 2019 08:32:18 GMT</pubDate>
    <dc:creator>ambadi007</dc:creator>
    <dc:date>2019-07-01T08:32:18Z</dc:date>
    <item>
      <title>Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570148#M160749</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data set like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Visit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cat1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cat2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;base line&amp;nbsp; &amp;nbsp;Gait&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;normal&lt;/P&gt;&lt;P&gt;day 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Stand&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;weak&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create this like in to one variable , so it should be now the variable visit should be looks like below&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Visit&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Base line&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Gait&lt;/P&gt;&lt;P&gt;&amp;nbsp;Normal&lt;/P&gt;&lt;P&gt;Day1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Stand&lt;/P&gt;&lt;P&gt;&amp;nbsp;Weak&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help on this scenario, and the vcat 2 variable length also high, so that there should not be any truncation also not there .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 07:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570148#M160749</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2019-07-01T07:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570149#M160750</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Visit :$20. cat1 $ cat2 $;
infile datalines dlm=',';
datalines;
base line,Gait,normal
day 1,Stand,weak
;

data want(keep=Visit);
    set have;
    array _{*} _character_;
    do i=1 to dim(_);
        Visit=_[i];
        output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Jul 2019 07:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570149#M160750</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-01T07:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570150#M160751</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Visit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cat1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;cat2&amp;nbsp; count&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;base line&amp;nbsp; &amp;nbsp;Gait&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;normal&lt;/P&gt;&lt;P&gt;day 1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Stand&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;weak&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to say that I have count also in the vars so if i use the code you have provided it is giving different formats. I need the formats looks like&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Visit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Base line&amp;nbsp; &amp;nbsp;20&lt;/P&gt;&lt;P&gt;&amp;nbsp;Gait&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Normal&amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;Day1&amp;nbsp; 40&lt;/P&gt;&lt;P&gt;&amp;nbsp;Stand&amp;nbsp; 1.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;Weak&amp;nbsp; 40&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like wise .. could you please modify the above code for me to check&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 07:59:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570150#M160751</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2019-07-01T07:59:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570151#M160752</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Visit :$20. cat1 $ cat2 $ count;
infile datalines dlm=',';
datalines;
base line,Gait,normal,1
day 1,Stand,weak,2
;

data want(keep=Visit count);
    set have;
    array _{*} _character_;
    do i=1 to dim(_);
        Visit=_[i];
        output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Jul 2019 08:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570151#M160752</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-01T08:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570152#M160753</link>
      <description>&lt;P&gt;I tried like this , but now the data is coming like not as expected&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no count for visit&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cat1 and Cat 2 has counts ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Visit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; count&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Base line&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Gait&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;Normal&amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;Day1&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Stand&amp;nbsp; 1.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;Weak&amp;nbsp; 40&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it should be like this .. and the above code is not working in that way...please help&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 08:16:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570152#M160753</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2019-07-01T08:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570153#M160754</link>
      <description>&lt;P&gt;Please specify &lt;EM&gt;exactly&amp;nbsp;&lt;/EM&gt;what your data looks like now and what your desired result looks like.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 08:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570153#M160754</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-01T08:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570155#M160755</link>
      <description>Now the data is coming with count values in visit also... ideally i want to show each visit the count for cat1 and cat2..as i mentioned above data structure</description>
      <pubDate>Mon, 01 Jul 2019 08:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570155#M160755</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2019-07-01T08:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570159#M160759</link>
      <description>&lt;P&gt;Please post the data you have in usable form and add the expected result.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 08:53:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570159#M160759</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-07-01T08:53:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570175#M160769</link>
      <description>&lt;P&gt;From your description of required output I guess your input as:&lt;/P&gt;
&lt;PRE&gt;data have(keep = str);
length str $32767;
input Visit &amp;amp;$9. count cat1 :$6. count1 cat2 :$6. count2;
str = catx(',', str,Visit,count,cat1, count1, cat2, count2);

datalines;
Base Line  20 Gait  1  Normal 1
Day1       40 Stand 1  Weak   40
;
run;&lt;/PRE&gt;
&lt;P&gt;A data step can be used to split the STR into pairs as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   do i = 1 to 6 by 2;
      Visit = scan(str, i, ',');
      Count = scan(str, i+1, ',');
      output;
   end;
drop str i;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 01 Jul 2019 11:16:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570175#M160769</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-07-01T11:16:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570471#M160862</link>
      <description>&lt;P&gt;Have&lt;/P&gt;&lt;P&gt;fttest visitnum visit&amp;nbsp; &amp;nbsp;stati total&lt;BR /&gt;delay core 1 day 1&amp;nbsp; &amp;nbsp; N&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 56&lt;BR /&gt;delay core 1 day 1&amp;nbsp; &amp;nbsp; Mean&amp;nbsp; &amp;nbsp;90&lt;BR /&gt;delay core 1 day 1&amp;nbsp; &amp;nbsp;Median 67&lt;BR /&gt;delay core 1 day 1&amp;nbsp; &amp;nbsp;Min&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;84&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Needed&lt;/P&gt;&lt;P&gt;fttest visitnum visit total&lt;BR /&gt;delay core 1 day 1&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N&amp;nbsp; &amp;nbsp; &amp;nbsp; 56&lt;BR /&gt;delay core 1 Mean&amp;nbsp; &amp;nbsp;90&lt;BR /&gt;delay core 1 Meadian&amp;nbsp; 67&lt;BR /&gt;delay core 1 Min Min 84&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:12:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570471#M160862</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2019-07-02T10:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570476#M160864</link>
      <description>&lt;PRE&gt;Have

fttest visitnum visit   stati total
delay core 1 day 1    N        56
delay core 1 day 1    Mean   90
delay core 1 day 1   Median 67
delay core 1 day 1   Min       84

 

Needed

fttest visitnum visit total
delay core 1 day 1 
                        N      56
delay core 1 Mean   90
delay core 1 Meadian  67
delay core 1 Min Min 84&lt;/PRE&gt;
&lt;P&gt;It looks that visitnum column takes 1 and visit takes "day 1" from HAVE.&lt;/P&gt;
&lt;P&gt;The first row in NEEDED has "day 1" and rest of the rows are not having it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Needs clarification to understand what is required.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570476#M160864</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-07-02T10:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570479#M160867</link>
      <description>&lt;P&gt;Yes&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need the data like each visit (eg-day 1) statistics for each ft test and corresponding total&lt;/P&gt;&lt;P&gt;So data should be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FTtest&amp;nbsp; visitnum&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;visit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;total&lt;/P&gt;&lt;PRE&gt;delay core 1      Day 1 N       56
delay core 1    Mean            90
delay core 1   Median          67
delay core 1    Min           84&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:45:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570479#M160867</guid>
      <dc:creator>ambadi007</dc:creator>
      <dc:date>2019-07-02T10:45:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create one variable from many</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570486#M160872</link>
      <description>&lt;P&gt;The first row of output has VISIT = "Day 1 N"&lt;/P&gt;
&lt;P&gt;If this logic is applied to other rows then VISIT must be "Day 1 Mean", "Day1 Median" and "Day 1 Min".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 11:02:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-one-variable-from-many/m-p/570486#M160872</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-07-02T11:02:44Z</dc:date>
    </item>
  </channel>
</rss>

