<?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 Assignment in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502317#M647</link>
    <description>&lt;P&gt;First, save the whole shambles to a csv file, so that you can take control over the import process (especially where you start to read, and how you name the columns). Read that with a suitable data step.&lt;/P&gt;
&lt;P&gt;Then, in a further data step, retain a variable with which you keep the sex, and use a subsetting if to only keep observations that meet your criteria.&lt;/P&gt;
&lt;P&gt;For the last part, you can once again write a data step, or use proc export.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Oct 2018 07:50:21 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-10-08T07:50:21Z</dc:date>
    <item>
      <title>SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502297#M640</link>
      <description>&lt;DIV class="attempt-header assessment-header uneditable"&gt;Does anyone know how to do this task?&lt;P&gt;&lt;STRONG&gt;Write&lt;/STRONG&gt; a SAS program to access the Microsoft Excel spreadsheet.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Create&lt;/STRONG&gt; a comma-delimited raw data file to store information that includes&amp;nbsp;sex, categories, and number of individuals in each category.&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Oct 2018 19:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502297#M640</guid>
      <dc:creator>jk101564</dc:creator>
      <dc:date>2018-10-08T19:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502312#M645</link>
      <description>&lt;P&gt;Please post the code you already have; post the log if you have problems, and describe where your results do not meet your expectations.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 06:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502312#M645</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-08T06:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502317#M647</link>
      <description>&lt;P&gt;First, save the whole shambles to a csv file, so that you can take control over the import process (especially where you start to read, and how you name the columns). Read that with a suitable data step.&lt;/P&gt;
&lt;P&gt;Then, in a further data step, retain a variable with which you keep the sex, and use a subsetting if to only keep observations that meet your criteria.&lt;/P&gt;
&lt;P&gt;For the last part, you can once again write a data step, or use proc export.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 07:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502317#M647</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-08T07:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502388#M660</link>
      <description>&lt;P&gt;I am new to the SAS and dont know much about it. i had the one assignment was really simple but then this that i dont&amp;nbsp;know much about. If you can help me that about be appreciated. I could come up with this but it is not working and i have to use the excel file and output should be in .CSV file. Right now the output is the whole excel file. I have attached the file.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;PROC IMPORT out= nyfile&lt;BR /&gt;DATAFILE = "/home/myfolder/nyfile.xlsx"&lt;BR /&gt;DBMS = XLSX REPLACE;&lt;BR /&gt;GETNAMES = no;&lt;BR /&gt;DBSASLABEL = NONE;&lt;BR /&gt;RUN;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here is the logs&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 PROC IMPORT out= nyfile&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 DATAFILE = "/home/myfolder/nyfile.xlsx"&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 DBMS = XLSX REPLACE;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 GETNAMES = no;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 DBSASLABEL = NONE;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 RUN;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: One or more variables were converted because the data type is not supported by the V9 engine. For more details, run with&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;options MSGLEVEL=I.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The import data set has 97 observations and 5 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: WORK.NYFILE data set was successfully created.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;user cpu time 0.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;system cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;memory 2660.21k&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;OS Memory 29608.00k&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Timestamp 10/08/2018 01:06:03 PM&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Step Count 72 Switch Count 4&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Faults 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Reclaims 651&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Page Swaps 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Voluntary Context Switches 20&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Involuntary Context Switches 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Block Input Operations 0&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Block Output Operations 264&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;90&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Mon, 08 Oct 2018 19:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502388#M660</guid>
      <dc:creator>jk101564</dc:creator>
      <dc:date>2018-10-08T19:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502414#M666</link>
      <description>&lt;P&gt;So I saved the Excel to a csv file and copied that to my SAS server. It's much easier to get the right types and contents if you don't force SAS to make guesses (what you have to do with the xlsx format). On top of that, I don't have ACCESS to PC Files licensed.&lt;/P&gt;
&lt;P&gt;Excel used a semicolon as delimiter (although csv explicitly means &lt;EM&gt;comma&lt;/EM&gt; seperated volume), so I had to adapt my input data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data in (keep=sex category ny kc);
infile
  '$HOME/sascommunity/nyfile.csv' /* filename on my server */
  dlm=';' /* use semicolon as delimiter */
  dsd /* in case a delimiter or an empty cell appears somewhere */
  firstobs=4 /* start in line 4, everything before that is irrelevant */
;
length /* set lengths for the variables needed */
  sex $6
  category $50
  ny 8
  var3 $10 /* var3 is just a dummy, as we only need the population estimates */
  kc 8
;
format ny kc comma12.; /* Nice format for the numbers */
label /* Nice names for the csv file */
  sex = 'Sex'
  category = 'Category'
  ny = 'Pop. Estimate New York'
  kc = 'Pop. Estimate Kings County'
;
retain sex '' flag 0; /* keep these variables across observations */
input
  category
  ny : comma12.
  var3
  kc : comma12.
;
/* determine the sex: */
if category in ('Male:','Female:') then sex = scan(category,1,':');
/* check the category fulltime or not: */
if substr(category,1,6) = 'Worked' then flag = 1;
if substr(category,1,5) = 'Other' then flag = 0;
if flag and category in ( /* only if we are in the right category and sub-category */
  '$55,000 to $64,999',
  '$65,000 to $74,999',
  '$75,000 to $99,999',
  '$100,000 or more'
); /* this is called a subsetting if */
run;

/* check the dataset */
proc print data=in noobs;
run;

/* the easiest part: create the csv */
proc export data=in file='$HOME/sascommunity/want.csv' dbms=csv replace label;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Output of the proc print:&lt;/P&gt;
&lt;PRE&gt; sex           category                   ny              kc

Male      $55,000 to $64,999         244,273          16,330
Male      $65,000 to $74,999         199,338          14,708
Male      $75,000 to $99,999         311,572          25,495
Male      $100,000 or more           462,618          59,399
Female    $55,000 to $64,999         176,444          13,596
Female    $65,000 to $74,999         130,768          11,639
Female    $75,000 to $99,999         184,576          18,605
Female    $100,000 or more           180,911          29,356
&lt;/PRE&gt;
&lt;P&gt;The csv file:&lt;/P&gt;
&lt;PRE&gt;"Sex","Category","Pop. Estimate New York","Pop. Estimate Kings County"
Male,"$55,000 to $64,999","244,273","16,330"
Male,"$65,000 to $74,999","199,338","14,708"
Male,"$75,000 to $99,999","311,572","25,495"
Male,"$100,000 or more","462,618","59,399"
Female,"$55,000 to $64,999","176,444","13,596"
Female,"$65,000 to $74,999","130,768","11,639"
Female,"$75,000 to $99,999","184,576","18,605"
Female,"$100,000 or more","180,911","29,356"
&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Oct 2018 14:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502414#M666</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-08T14:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502460#M679</link>
      <description>&lt;P&gt;thanks for quick reply. I tried that but only title's are showing up in the output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 19:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502460#M679</guid>
      <dc:creator>jk101564</dc:creator>
      <dc:date>2018-10-08T19:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502469#M680</link>
      <description>&lt;P&gt;I looked at the logs closer and it is not reading the number.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: Invalid data for ny in line 5 1-102.
 NOTE: Invalid data for kc in line 7 1-63.
 RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0                      
 7               With income:,"2,488,381","+/-15,432","180,569","+/-3,300" 63
 NOTE: Invalid data errors for file ''/home/myfolder/nyfile.csv'' occurred outside the printed range.
 NOTE: Increase available buffer lines with the INFILE n= option.
 sex=  category=Male:,"5,148,815","+/-3,463","326,951",+/-302 ny=. var3=No income, kc=. flag=0 _ERROR_=1 _N_=1
 NOTE: Invalid data for ny in line 9 1-52.
 NOTE: Invalid data for kc in line 11 1-57.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Does anyone know how to format&amp;nbsp;those numbers?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 17:56:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502469#M680</guid>
      <dc:creator>jk101564</dc:creator>
      <dc:date>2018-10-08T17:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502471#M681</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;! Looks like &lt;A href="https://communities.sas.com/t5/SAS-Programming/Noob-Question-Basic-SAS-How-to-display-and-INPUT-But-need-help/td-p/332418" target="_self"&gt;you've helped to solve this problem before&lt;/A&gt;&amp;nbsp;-- maybe just the County name has changed &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 18:16:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502471#M681</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-10-08T18:16:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Assignment</title>
      <link>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502474#M683</link>
      <description>&lt;P&gt;thank you so much&amp;nbsp;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_blank"&gt;@KurtBremser&lt;/A&gt;. I think i got it what was wrong with the code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 18:26:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/SAS-Assignment/m-p/502474#M683</guid>
      <dc:creator>jk101564</dc:creator>
      <dc:date>2018-10-08T18:26:08Z</dc:date>
    </item>
  </channel>
</rss>

