<?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: SAS Beginer- facing issues in Arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562942#M157768</link>
    <description>&lt;P&gt;the only PROC PRINT in your program is of the original data (Sales). You need&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=Test2; run;&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2019 17:59:04 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-05-31T17:59:04Z</dc:date>
    <item>
      <title>SAS Beginner - facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562386#M157536</link>
      <description>&lt;P&gt;I cant able to use "Dim" code while practicing arrays in university edition. Kindly help.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Sales;
input Product $ Cprice Sprice Profit;
cards;
Chairs 200 400  .
Tables 125  .  121
ladder  .  596 125
Desk   148 265  .
;
run;
proc print data=sales;
run;

data test2;
set Sales;
array abc (*) _numeric_;
do i=1 to dim(sales)
if abc {i}=. then abc{i}=0;
end;
run;
proc print data=test2;

ERROR:

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         
 74         data test2;
 75         set Sales;
 76         array abc (*) _numeric_;
 77         do i=1 to dim(sales)
 78         if abc {i}=. then abc{i}=0;
            __
            79
 ERROR: The DIM, LBOUND, and HBOUND functions require an array name for the first argument.
 ERROR 79-322: Expecting a ;.
 
 79         end;
 80         run;
 
 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.TEST2 may be incomplete.  When this step was stopped there were 0 observations and 6 variables.
 WARNING: Data set WORK.TEST2 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.01 seconds
       
 
 81         proc print data=test2
 82         
 83         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
            _______
            22
            76
 ERROR 22-322: Syntax error, expecting one of the following: ;, (, BLANKLINE, CONTENTS, DATA, DOUBLE, GRANDTOTAL_LABEL, 
               GRANDTOT_LABEL, GRAND_LABEL, GTOTAL_LABEL, GTOT_LABEL, HEADING, LABEL, N, NOOBS, NOSUMLABEL, OBS, ROUND, ROWS, SPLIT, 
               STYLE, SUMLABEL, UNIFORM, WIDTH.  
 ERROR 76-322: Syntax error, statement will be ignored.
 84         ODS HTML CLOSE;
 85         &amp;amp;GRAPHTERM; ;*';*";*/;RUN;
 
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 85       !                           QUIT;
 86         QUIT;RUN;
 87         ODS HTML5 (ID=WEB) CLOSE;
 88         
 89         ODS RTF (ID=WEB) CLOSE;
 90         ODS PDF (ID=WEB) CLOSE;
 NOTE: ODS PDF(WEB) printed no output. 
       (This sometimes results from failing to place a RUN statement before the ODS PDF(WEB) CLOSE statement.)
 91         FILENAME _GSFNAME;
 NOTE: Fileref _GSFNAME has been deassigned.
 
 
 92         DATA _NULL_;
 93         RUN;
 
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 94         OPTIONS VALIDMEMNAME=COMPAT;
 95         OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
 96         &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 May 2019 01:53:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562386#M157536</guid>
      <dc:creator>Deepak13</dc:creator>
      <dc:date>2019-05-30T01:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562387#M157537</link>
      <description>&lt;PRE&gt;data test2;
set Sales;
array abc (*) _numeric_;
do i=1 to dim(&lt;FONT color="#ff0000" size="5"&gt;&lt;STRONG&gt;sales&lt;/STRONG&gt;&lt;/FONT&gt;)
if abc {i}=. then abc{i}=0;
end;
run;
&lt;/PRE&gt;
&lt;P&gt;DIM takes an ARRAY name as the argument of the function. SALES as far as I can see is a data set name, not an array. The only array possible in this step to use with the DIM function is ABC.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have other syntax issues such as missing ; before the options statement on line 83&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562387#M157537</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-29T18:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562388#M157538</link>
      <description>&lt;P&gt;Nothing to do with arrays. Put a semicolon at the end of the DO statement:&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;do i&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; to &lt;SPAN class="token function"&gt;dim&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;abc&lt;SPAN class="token punctuation"&gt;);&amp;nbsp;&amp;nbsp;/* &amp;lt;===&amp;nbsp;HERE */&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 May 2019 18:53:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562388#M157538</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-05-29T18:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562390#M157539</link>
      <description>&lt;PRE&gt;data test2;
	set Sales;
	array abc (*) _numeric_;

	do i=1 to dim(&lt;FONT color="#339966"&gt;abc&lt;/FONT&gt;)&lt;FONT color="#339966"&gt;;&lt;/FONT&gt;
		if abc{i}=. then
			abc{i}=0;
	end;
run;&lt;/PRE&gt;&lt;P&gt;Try this code. Two modifications are required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. A Semi colon was missing at the end of the do statement.&lt;/P&gt;&lt;P&gt;2. Array name should be used inside dim&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 18:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562390#M157539</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-05-29T18:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562914#M157755</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what code should I use other than DIM? As it is not working in SAS UE.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 17:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562914#M157755</guid>
      <dc:creator>Deepak13</dc:creator>
      <dc:date>2019-05-31T17:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562916#M157756</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Sales;
input Product $ Cprice Sprice Profit;
cards;
Chairs 200 400  .
Tables 125  .  121
ladder  .  596 125
Desk   148 265  .
;
run;
proc print data=sales;
run;

data test2;
set Sales;
array abc (*) _numeric_;
do i=1 to dim(abc);
if abc {i}=. then abc{i}=0;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what code should I use other than DIM? As it is not working in SAS UE.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 17:06:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562916#M157756</guid>
      <dc:creator>Deepak13</dc:creator>
      <dc:date>2019-05-31T17:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562924#M157760</link>
      <description>&lt;P&gt;Whenever you say "it is not working," please show us the output and explain what you think the output should have been.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your code works fine if the goal is to replace missing values by 0.&amp;nbsp; The output should be&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=test2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.TEST2" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Product&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Cprice&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Sprice&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;Profit&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;i&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="l data"&gt;Chairs&lt;/TD&gt;
&lt;TD class="r data"&gt;200&lt;/TD&gt;
&lt;TD class="r data"&gt;400&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="l data"&gt;Tables&lt;/TD&gt;
&lt;TD class="r data"&gt;125&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;121&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="l data"&gt;ladder&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;596&lt;/TD&gt;
&lt;TD class="r data"&gt;125&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;
&lt;TD class="l data"&gt;Desk&lt;/TD&gt;
&lt;TD class="r data"&gt;148&lt;/TD&gt;
&lt;TD class="r data"&gt;265&lt;/TD&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;4&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 31 May 2019 17:11:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562924#M157760</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-05-31T17:11:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562929#M157762</link>
      <description>&lt;P&gt;Yes Rick, I need 0 in my results, But I still get . in my result. Apologies for wage posts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Log:
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         data Sales;
 74         input Product $ Cprice Sprice Profit;
 75         cards;
 
 NOTE: The data set WORK.SALES has 4 observations and 4 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 80         ;
 81         run;
 82         proc print data=sales;
 83         run;
 
 NOTE: There were 4 observations read from the data set WORK.SALES.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.08 seconds
       cpu time            0.08 seconds
       
 
 84         
 85         data test2;
 86         set Sales;
 87         array abc (*) _numeric_;
 88         do i=1 to dim(abc);
 89         if abc {i}=. then abc{i}=0;
 90         end;
 91         run;
 
 NOTE: There were 4 observations read from the data set WORK.SALES.
 NOTE: The data set WORK.TEST2 has 4 observations and 5 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.01 seconds
       cpu time            0.01 seconds
       
 
 92         
 93         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 106        



Result
Obs	Product	Cprice	Sprice	Profit
1	Chairs	200	400	.
2	Tables	125	.	121
3	ladder	.	596	125
4	Desk	148	265	.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 31 May 2019 17:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562929#M157762</guid>
      <dc:creator>Deepak13</dc:creator>
      <dc:date>2019-05-31T17:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Beginer- facing issues in Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562942#M157768</link>
      <description>&lt;P&gt;the only PROC PRINT in your program is of the original data (Sales). You need&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=Test2; run;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 17:59:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Beginner-facing-issues-in-Arrays/m-p/562942#M157768</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-05-31T17:59:04Z</dc:date>
    </item>
  </channel>
</rss>

