<?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 How to set value of 0 after transposing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614737#M179775</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a bit of an issue trying to figure out how can I set a zero value to the data after transposing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After I transposed the data I have over 1200 variables that blank and I want to set them as zero with out having to write out all variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attempted using an array however that failed on me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please Help Me!!!&lt;/P&gt;</description>
    <pubDate>Thu, 02 Jan 2020 11:59:52 GMT</pubDate>
    <dc:creator>amyk</dc:creator>
    <dc:date>2020-01-02T11:59:52Z</dc:date>
    <item>
      <title>How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614737#M179775</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having a bit of an issue trying to figure out how can I set a zero value to the data after transposing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After I transposed the data I have over 1200 variables that blank and I want to set them as zero with out having to write out all variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attempted using an array however that failed on me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please Help Me!!!&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 11:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614737#M179775</guid>
      <dc:creator>amyk</dc:creator>
      <dc:date>2020-01-02T11:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614739#M179776</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/242815"&gt;@amyk&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy new year!&lt;/P&gt;
&lt;P&gt;Could you please share a sample of your data?&lt;/P&gt;
&lt;P&gt;2 options come into mind mind:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;If all the transposed data (and only them) are numeric, you can mention them in an array as &lt;FONT color="#FF00FF"&gt;_numeric_&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;If the name of all the new columns start with the same prefix (let's say 'col'), you can mention them in an array by using col&lt;FONT color="#FF00FF"&gt;:&lt;/FONT&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 02 Jan 2020 12:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614739#M179776</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-01-02T12:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614742#M179777</link>
      <description>&lt;P&gt;Hi Ed&lt;/P&gt;&lt;P&gt;Thanks for the quick response. After Transposing the variables don't have the same prefix. Below is what I had started to do.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code blow intention was to have an array to contain all the variables and set them a value of zero the variables that don;t have a value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data CheckboxFinal ;&lt;BR /&gt;set CheckBoxCount ;&lt;BR /&gt;array varlist{*} TotalCheckBox;&lt;BR /&gt;do i = 1 to dim(varlist) ;&lt;BR /&gt;if varlist{i} = . then varlist{i} = 0 ;&lt;/P&gt;&lt;P&gt;end ;&lt;/P&gt;&lt;P&gt;drop _NAME_ i ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 12:48:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614742#M179777</guid>
      <dc:creator>amyk</dc:creator>
      <dc:date>2020-01-02T12:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614746#M179779</link>
      <description>&lt;P&gt;Since I didn't have any sample data I constructed this simple example but it should work just fine for you. Just replace the variable definition with your set statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.result(drop=i);
 x = .;
 p = 6;
 array a{*} _numeric_;
 do i = 1 to dim(a);
  if a{i}=. then a{i}=0;
 end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 02 Jan 2020 13:06:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614746#M179779</guid>
      <dc:creator>Criptic</dc:creator>
      <dc:date>2020-01-02T13:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614750#M179780</link>
      <description>&lt;P&gt;That code is only testing the one variable named TotalCheckBox, which you could more easily do without the array.&lt;/P&gt;
&lt;P&gt;The array definition needs to include all of the variables that you wish to apply the changes to.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 13:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614750#M179780</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-02T13:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614754#M179781</link>
      <description>&lt;P&gt;Thats the thing is that i have over 1200 variables to loop through and set the zero. However I am trying to find away instead of hard coding all the variables&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 13:31:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614754#M179781</guid>
      <dc:creator>amyk</dc:creator>
      <dc:date>2020-01-02T13:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614755#M179782</link>
      <description>Just use the _numeric_ and _character_ keywords like I did in my example. That will create an array with all numeric/character variables</description>
      <pubDate>Thu, 02 Jan 2020 13:35:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614755#M179782</guid>
      <dc:creator>Criptic</dc:creator>
      <dc:date>2020-01-02T13:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614760#M179784</link>
      <description>&lt;P&gt;Here's a couple ideas/approaches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines missover;
	input id a1-a1000;
	datalines;
1
2
3
;
run;

*Option 1 - Vars are arranged in a numeric sequence;
* -- (or side-by-side: replace a1-a1000 with a1--a1000);
data want;
	set have;
	array myarr a1-a1000;

	do over myarr;
		if myarr=. then
			myarr=0;
	end;
run;

*Option 2 - Select desired variables into a macro variable;
proc means data=have nolabels NMISS stackodsoutput;
	var _NUMERIC_;
	ods output Summary=MissingValues;
run;
proc sql noprint;
	select variable into :myvars separated by " " 
	from missingvalues 
	where nmiss&amp;gt;0 /*or specify variable in (...) list*/
	;
quit;

data want;
	set have;
	array myarr &amp;amp;myvars;

	do over myarr;
		if myarr=. then
			myarr=0;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can also make use of dictionary.columns within proc sql to get the desired list of variables into a macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 14:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614760#M179784</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2020-01-02T14:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614776#M179786</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/242815"&gt;@amyk&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having a bit of an issue trying to figure out how can I set a zero value to the data after transposing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After I transposed the data I have over 1200 variables that blank and I want to set them as zero with out having to write out all variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I attempted using an array however that failed on me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please Help Me!!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Perhaps this is an indication that Transpose wasn't really needed.&amp;nbsp; Or perhaps you should use a different approach to the transpose.&lt;/P&gt;
&lt;P&gt;Can you show a small example of the input data and what you need it to look like after the transpose. (Be prepared to answer questions about why the data needs that transposed structure.)&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2020 15:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614776#M179786</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-02T15:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to set value of 0 after transposing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614957#M179819</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc stdize data=have out=want missing=0 reponly;
var _numeric_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Jan 2020 13:13:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-set-value-of-0-after-transposing/m-p/614957#M179819</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-01-03T13:13:25Z</dc:date>
    </item>
  </channel>
</rss>

