<?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 write array statement for satisfaction question? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857359#M338790</link>
    <description>Thank you so much for taking your time to answer this post. I tried to do it on my own but I just cannot find the solution. Anyway, I'll try to understand your command. Thank you once again, I really appreciate it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Mon, 06 Feb 2023 13:45:06 GMT</pubDate>
    <dc:creator>Ainn_</dc:creator>
    <dc:date>2023-02-06T13:45:06Z</dc:date>
    <item>
      <title>How do I write array statement for satisfaction question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857340#M338778</link>
      <description>&lt;P&gt;Hi. I want to ask a question regarding an array statement. How do I make the statement for satisfaction question? Honestly, I don't quite understand what the question wants... This is a little bit about the question.. I've also attached the file and the pics.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;SATISFACTION.txt&lt;/STRONG&gt; data set is an employee’s answer/response on satisfaction question. This question consists of two domains which are Domain A (question 1-6) and Domain B (question 7-15). Each question has four choices of likert scale (1-4).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to make a table with error like the pic below. The value should be 1&amp;lt;value=&amp;gt;4. I tried the command below but it didn't work. And for the table without error, the value should be 1&amp;lt;value=&amp;lt;4.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the command that I wrote..&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.satisfaction;&lt;BR /&gt;infile "/home/u62529475/satisfaction.txt" dlm=',';&lt;BR /&gt;input EmployeeID 6 Gender $7;&lt;BR /&gt;datalines;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;value $gender 'F'='Female'&lt;BR /&gt;'M'='Male';&lt;/P&gt;&lt;P&gt;run;&lt;BR /&gt;data work.error;&lt;BR /&gt;set satisfaction;&lt;BR /&gt;array Response{15} S1-S15;&lt;BR /&gt;array Answer{15} 3 _temporary_ (1, 2, 3, 4, 1, 2, 3, 4,&lt;BR /&gt;1, 2, 3, 4, 1, 2, 3);&lt;BR /&gt;do i=1 to 15;&lt;BR /&gt;if Answer{i} ge 1 then output work.error;&lt;BR /&gt;end;&lt;BR /&gt;drop i;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;title "Observations in Satisfaction data set with errors";&lt;BR /&gt;proc print data=work.error;&lt;BR /&gt;format EmployeeID 6. Gender $gender.;&lt;BR /&gt;run;&lt;BR /&gt;title;&lt;/P&gt;&lt;P&gt;I really don't know how to do this and if anyone can help me asap, I greatly appreciate it.. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 11:59:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857340#M338778</guid>
      <dc:creator>Ainn_</dc:creator>
      <dc:date>2023-02-06T11:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write array statement for satisfaction question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857344#M338780</link>
      <description>&lt;P&gt;Below your homework done. Please spend the time to understand what I've done as else you won't learn anything but just wasted my time.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.satisfaction;
  infile "c:\test\satisfaction.txt" dlm=' ' dsd;
  input EmployeeID :$10. Gender :$1. (a1-a15) (:best32.);
run;

data without error;
  set work.satisfaction;
  array _vals{*} a1-a15;
  do _i=1 to dim(_vals);
    if _vals[_i]&amp;lt;1 or _vals[_i]&amp;gt;4 then 
      do;
        output error;
        return;
      end;
  end;
  output without;
  drop _i;
run;

proc print data=error;
run;

data without;
  set without;
  AverageA=mean(of a1-a6);
  AverageB=mean(of a7-a15);
  Overall_Satisfaction=mean(of a1-a15);
run;

proc print data=without;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Feb 2023 19:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857344#M338780</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-02-06T19:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I write array statement for satisfaction question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857359#M338790</link>
      <description>Thank you so much for taking your time to answer this post. I tried to do it on my own but I just cannot find the solution. Anyway, I'll try to understand your command. Thank you once again, I really appreciate it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Mon, 06 Feb 2023 13:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-write-array-statement-for-satisfaction-question/m-p/857359#M338790</guid>
      <dc:creator>Ainn_</dc:creator>
      <dc:date>2023-02-06T13:45:06Z</dc:date>
    </item>
  </channel>
</rss>

