<?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: Proc report or proc tabulate to fix the job - help needed in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828602#M327317</link>
    <description>I appreciate your answer and tip &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;, but I'm really a rookie in proc report. &lt;BR /&gt;Like in my OP: what I want is some help with this. &lt;BR /&gt;I really need some worked out example for my data, so I can get going with this and explore the proc report more and more, like you say.&lt;BR /&gt;But thanks anyway for your reaction!</description>
    <pubDate>Sun, 14 Aug 2022 10:31:28 GMT</pubDate>
    <dc:creator>SAS_Question</dc:creator>
    <dc:date>2022-08-14T10:31:28Z</dc:date>
    <item>
      <title>Proc report or proc tabulate to fix the job - help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828590#M327308</link>
      <description>&lt;P&gt;Please see the attachment for the data I use in HAVE!&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.HAVE;
/* change path to fit your setup! */
  infile "D:\GRADES\import.txt" 
	delimiter = "|"
	missover 
	dsd
	firstobs=2;
 
	informat ID $20.;
	informat CAT_NR $20.;
	informat DATE YYMMDD10.;
	informat EARNED_CREDIT $20.;
	informat CAT_COMPONENT $20.;
	informat C_GRADE $20.;
	informat N_GRADE 4.;
	informat CREDIT 4.;

	format ID $20.;
	format CAT_NR $20.;
	format DATE YYMMDD10.;
	format EARNED_CREDIT $20.;
	format CAT_COMPONENT $20.;
	format C_GRADE $20.;
	format N_GRADE 4.;
	format CREDIT 4.;

	input
	ID
	CAT_NR 
	DATE 
	EARNED_CREDIT
	CAT_COMPONENT
	C_GRADE
	N_GRADE
	CREDIT
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I HAVE this fictive students grades data. &lt;BR /&gt;This is how it works:&lt;/P&gt;
&lt;P&gt;A grade will get the corresponding credit (of 0, 5, 10, 15 etc.) if it is 5.5 or higher. &lt;BR /&gt;If a grade is lower than 5.5 it will not get a credit(registration) in the data!&lt;/P&gt;
&lt;P&gt;If a student gets a grade for a CAT_COMPONENT other than 'CRED', then that grade will always &lt;BR /&gt;be registered on that corresponding CAT_NR (ending with xxxxEXAM/xxxPROJ/etc.) &lt;BR /&gt;Even if this grade is lower than 5.5! &lt;BR /&gt;Please note: the CAT_NR ones ending with xxxCRED -&amp;gt; are not EXAMS/PROJ/CASE/etc, &lt;BR /&gt;those are only used for registering credits (0, 5, 10, 15 etc).&lt;/P&gt;
&lt;P&gt;The normal case is that students make exams, projects, cases, etc, and get graded for that. &lt;BR /&gt;But sometimes there are students with exemptions. Meaning they have already did that exam in other school etc.&lt;BR /&gt;They get credited without making these exams/projects/cases again. &lt;BR /&gt;In these cases: &lt;BR /&gt;If it is an exemption credit (meaning C_GRADE='FR') then it is directly credited on CRED (without an EXAM grade) and the N_grade is always: 6 in these cases.&lt;BR /&gt;If it is another credit with some value/meaning (C_Grade='A'), then it has always N_Grade=8.&lt;BR /&gt;If it is another credit without some value/meaning (C_Grade='-'), then it has always N_Grade=0.&lt;/P&gt;
&lt;P&gt;Let me give an example: &lt;BR /&gt;--------------------------------------------- begin of example!&lt;BR /&gt;If student '29A86T8' gets in his first chance a grade of 3.5 for CAT_NR 'BA0AM106EXAM' in the year 2021, &lt;BR /&gt;and a grade of 5.7 in his next chance in the year of 2022, &lt;BR /&gt;and he got an exemption for cat_nr: 'PA01300PACRED' (with CRED value of 10)&lt;BR /&gt;he will be registered like these 4 (!) rows in the table of HAVE:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;OBS|ID|CAT_NR|DATE|EARNED_CREDIT|CAT_COMPONENT|C_GRADE|N_GRADE|CREDIT

1|29A86T8|BA0AM106EXAM|2021-06-16|N|EXAM|3,5|3.5|0
(please note: in this case he gets no credit registration, because the grade is lower than 5.5!)

2|29A86T8|BA0AM106EXAM|2022-06-16|Y|EXAM|5,7|5.7|5
3|29A86T8|BA0AM106CRED|2022-06-16|Y|CRED|5,7|5.7|5
4|29A86T8|PA01300PACRED|2022-06-16|Y|CRED|FR|6|10

(please note: in this case the grade is 5.5 or higher so he gets the credit = earned_credit='Y'!
please note also the exemption how it is registered. )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So in this case student 29A86T8 got his CREDIT eventually in the year 2022 with 2 chances for the Cat_NR: &lt;BR /&gt;BA0AM106EXAM&lt;BR /&gt;And he got the credit for PA01300PACRED because of his exemption. &lt;BR /&gt;&lt;BR /&gt;So he did the exam 2 times before succeeding for this exam.&lt;BR /&gt;And he used 1 exemption. &lt;BR /&gt;----------------------------------------------------- end of example!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I hope you understand my data better? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;If yes, then this is what I WANT:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;To learn a bit more about proc report/proc tabulate, &lt;BR /&gt;I want some help with this specific procs used. &lt;BR /&gt;Can someone help out and show me how to show this with the help of proc report or tabulate?&lt;/P&gt;
&lt;P&gt;WANT, something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="WANT.PNG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/74421i8BB27631325D3374/image-size/medium?v=v2&amp;amp;px=400" role="button" title="WANT.PNG" alt="WANT.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So 1 proc report/tabulate result showing: &lt;BR /&gt;all grades in columns, and also a min_grade, max_grade, avg_grade, N_grade(=how many chances until succeeded?), sum_of_CREDITS &lt;BR /&gt;this should be all: &lt;BR /&gt;-per year, &lt;BR /&gt;-per student(ID), &lt;BR /&gt;-per CAT_NR (so if there are 2 chances like above we should see only 1 row summing all the grades in 1 row not 2 for the same CAT_NR). &lt;BR /&gt;And please note: we want to show only the CAT_NR which are ending with CRED (so we need to merge alle the grades in to CRED)!&lt;/P&gt;
&lt;P&gt;In the end I want to show 1 row for each student for each year for each Cat_NR. &lt;BR /&gt;Is that possible with proc report? &lt;BR /&gt;Can someone help out? Thanks in advance!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 22:53:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828590#M327308</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2022-08-13T22:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report or proc tabulate to fix the job - help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828592#M327309</link>
      <description>&lt;P&gt;Highly appreciated that you provided sample data with fully working code.&lt;/P&gt;
&lt;P&gt;Given the layout you're showing I'd certainly go for Proc Report as it allows for more flexibility than Proc Tabulate.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest you invest a bit of time investigating how Proc Report works.&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0bqogcics9o4xn17yvt2qjbgdpi.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p0bqogcics9o4xn17yvt2qjbgdpi.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm myself not a frequent report creator and though not that "fluent" with Proc Report. If I have to create a bit more advanced reports then I normally spend some time Googling for examples (it's much out there) and then use the most fitting sample code as my starting point.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Aug 2022 23:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828592#M327309</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-08-13T23:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: Proc report or proc tabulate to fix the job - help needed</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828602#M327317</link>
      <description>I appreciate your answer and tip &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12447"&gt;@Patrick&lt;/a&gt;, but I'm really a rookie in proc report. &lt;BR /&gt;Like in my OP: what I want is some help with this. &lt;BR /&gt;I really need some worked out example for my data, so I can get going with this and explore the proc report more and more, like you say.&lt;BR /&gt;But thanks anyway for your reaction!</description>
      <pubDate>Sun, 14 Aug 2022 10:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-report-or-proc-tabulate-to-fix-the-job-help-needed/m-p/828602#M327317</guid>
      <dc:creator>SAS_Question</dc:creator>
      <dc:date>2022-08-14T10:31:28Z</dc:date>
    </item>
  </channel>
</rss>

