<?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: How do i get this concatinated output using Dataset method? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752556#M237084</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards length=len;
input have $varying400. len;
if have=:'PT' then id+1;
n+1;
if anydigit(have)=1 then do;
  subjid=scan(have,1,' ');sex=upcase(char(scan(have,2,' '),1));
end;
if lowcase(scan(have,1,' '))='studyname' then studyid=scan(have,-1,' ');
if lowcase(scan(have,1,' '))='site' then siteid=scan(have,-1,' ');
if lowcase(scan(have,1,' '))='domain' then domain=scan(have,-1,' ');
if not missing(coalescec(subjid,sex,studyid,siteid,domain));
drop have;
cards;
(Given Data)
PT  Gender 

101 Male
102 M
103 Female
104 MALE
105 f
(Given Data)
studyname - GSK101A2
site no  : G101
SEX  -  M OR F
Domain  - DM 
;

proc sort data=have;by id descending n;run;
data want;
 update have(obs=0) have;
 by id;
 if not missing(subjid) then output;
run;

data want;
 set want;
 usubjid=cats(studyid,'-',siteid,'-',subjid);
run;
proc sort data=want;by id n;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 07 Jul 2021 13:18:13 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-07-07T13:18:13Z</dc:date>
    <item>
      <title>How do i get this concatinated output using Dataset method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752519#M237071</link>
      <description>&lt;P&gt;(Given Data)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;PT&amp;nbsp; Gender&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;101 Male&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;102 M&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;103 Female&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;104 MALE&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;105 f&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;(Given Data)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;studyname - GSK101A2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;site no&amp;nbsp; : G101&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;SEX&amp;nbsp; -&amp;nbsp; M OR F&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Domain&amp;nbsp; - DM&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Required o/p : (i need the output like this)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;STUYID &lt;/SPAN&gt;&lt;SPAN style="font-weight: 400;"&gt;DOMAIN&lt;/SPAN&gt; &lt;SPAN style="font-weight: 400;"&gt;USUBJID&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUBJID &amp;nbsp; &amp;nbsp; &amp;nbsp; SEX&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;GSK101A2&amp;nbsp; DM&amp;nbsp; &amp;nbsp; GSK101A2-G101-101&amp;nbsp; &amp;nbsp; 101 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;GSK101A2&amp;nbsp; DM&amp;nbsp; &amp;nbsp; GSK101A2-G101-102&amp;nbsp; &amp;nbsp; 102 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;GSK101A2&amp;nbsp; DM&amp;nbsp; &amp;nbsp; GSK101A2-G101-103&amp;nbsp; &amp;nbsp; 103 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;GSK101A2&amp;nbsp; DM&amp;nbsp; &amp;nbsp; GSK101A2-G101-104&amp;nbsp; &amp;nbsp; 104 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;GSK101A2&amp;nbsp; DM&amp;nbsp; &amp;nbsp; GSK101A2-G101-105&amp;nbsp; &amp;nbsp; 105 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 10:37:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752519#M237071</guid>
      <dc:creator>Akhilaaron07</dc:creator>
      <dc:date>2021-07-07T10:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get this concatinated output using Dataset method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752542#M237078</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/388613"&gt;@Akhilaaron07&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;P&gt;(Given Data)&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;studyname - GSK101A2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;site no&amp;nbsp; : G101&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;SEX&amp;nbsp; -&amp;nbsp; M OR F&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-weight: 400;"&gt;Domain&amp;nbsp; - DM&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are these name/value pairs in a dataset, or did you mistakenly represent the data in transposed form?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 12:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752542#M237078</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-07T12:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get this concatinated output using Dataset method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752544#M237079</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
   length STUDYID $8 DOMAIN $2 USUBJID $17 SEX $1;
   set have;
   
   array chars STUDYID DOMAIN SITENO PT SEX;
   do over chars;
      chars=strip(upcase(chars));
   end;

   SUBJID=strip(put(PT,best.));
   if cmiss(STUDYID,SITENO,SUBJID) ne 0 then put 'E' 'RROR: Missing unexpected variables encountered' STUDYID= SITENO= SUBJID=;
   else USUBJID=catx('-',STUDYID,SITENO,SUBJID);
   SEX=ifc(SEX^='',substr(SEX,1,1),'');
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jul 2021 12:51:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752544#M237079</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-07-07T12:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get this concatinated output using Dataset method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752556#M237084</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards length=len;
input have $varying400. len;
if have=:'PT' then id+1;
n+1;
if anydigit(have)=1 then do;
  subjid=scan(have,1,' ');sex=upcase(char(scan(have,2,' '),1));
end;
if lowcase(scan(have,1,' '))='studyname' then studyid=scan(have,-1,' ');
if lowcase(scan(have,1,' '))='site' then siteid=scan(have,-1,' ');
if lowcase(scan(have,1,' '))='domain' then domain=scan(have,-1,' ');
if not missing(coalescec(subjid,sex,studyid,siteid,domain));
drop have;
cards;
(Given Data)
PT  Gender 

101 Male
102 M
103 Female
104 MALE
105 f
(Given Data)
studyname - GSK101A2
site no  : G101
SEX  -  M OR F
Domain  - DM 
;

proc sort data=have;by id descending n;run;
data want;
 update have(obs=0) have;
 by id;
 if not missing(subjid) then output;
run;

data want;
 set want;
 usubjid=cats(studyid,'-',siteid,'-',subjid);
run;
proc sort data=want;by id n;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Jul 2021 13:18:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752556#M237084</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-07T13:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get this concatinated output using Dataset method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752572#M237089</link>
      <description>&lt;P&gt;/*The data items could be input using macro variables to make this flexible.*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data Want ; &lt;BR /&gt;set Have (rename=( pt=SUBJID));&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *the dataset with PT and gender ;&lt;BR /&gt;STUYID= "GSK101A2";&lt;BR /&gt;DOMAIN= "DM" ;&lt;BR /&gt;SiteNo = "G101" ;&lt;BR /&gt;&lt;BR /&gt;length USUBJID $ 17;&lt;BR /&gt;drop siteno gender;&lt;BR /&gt;&lt;BR /&gt;USUBJID= catx("-",stuyid,siteno, subjid);&lt;BR /&gt;SEX= substr(upcase(gender),1,1);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;proc print data=reqdop ;&lt;BR /&gt;var stuyid domain usubjid subjid sex;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 13:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752572#M237089</guid>
      <dc:creator>john_robinson</dc:creator>
      <dc:date>2021-07-07T13:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do i get this concatinated output using Dataset method?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752602#M237110</link>
      <description>Guys Finally i got the output i am not removing it, If any one in Future happens to Stumble up on it.&lt;BR /&gt;&lt;BR /&gt;data dm1;&lt;BR /&gt;input PT Gender$;&lt;BR /&gt;datalines;&lt;BR /&gt;101 Male&lt;BR /&gt;102 M&lt;BR /&gt;103 Female&lt;BR /&gt;104 MALE&lt;BR /&gt;105 f&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;Data DM;&lt;BR /&gt;STUDYID="GSK101A2";&lt;BR /&gt;DOMAIN="DM";&lt;BR /&gt;SITEID="G101";&lt;BR /&gt;length USUBJID $20. ;&lt;BR /&gt;set dm1(rename= (PT=SUBJID));&lt;BR /&gt;USUBJID= catx("-",STUDYID,SITEID,SUBJID);&lt;BR /&gt;If Gender in('M','Male','MALE') then SEX='M';&lt;BR /&gt;else SEX='F';&lt;BR /&gt;drop Gender;&lt;BR /&gt;run;</description>
      <pubDate>Wed, 07 Jul 2021 15:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-i-get-this-concatinated-output-using-Dataset-method/m-p/752602#M237110</guid>
      <dc:creator>Akhilaaron07</dc:creator>
      <dc:date>2021-07-07T15:41:37Z</dc:date>
    </item>
  </channel>
</rss>

