<?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: Report the distribution in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804392#M316758</link>
    <description>&lt;P&gt;That's a good start.&amp;nbsp; Presumably your first data set contains one observation per patient, but the others may contain many observations per patient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without writing any SAS code (yet), you might consider whether a patient was taking any medications.&amp;nbsp; One way to do that would be to examine the second data set and see if any of the fill dates are filled in.&amp;nbsp; To consider whether a patient had any doctor visits, you might examine the third data set and check whether any of the service dates are filled in.&amp;nbsp; These steps could conceivably find that a patient took many drugs, or had many doctor visits.&amp;nbsp; So the results from these checks would still need to reduce the results down to a single observation per patient with (perhaps) a Y/N result for "any drugs" and another Y/N result for "any visits".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on what you know, see if the related question (your original question #1) at least becomes approachable.&lt;/P&gt;</description>
    <pubDate>Sun, 27 Mar 2022 15:10:52 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2022-03-27T15:10:52Z</dc:date>
    <item>
      <title>Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804373#M316751</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Can someone pls explain what this questions mean. I can't create a dummy variable because I don't understand the question. Any simple sas code to help understand the questions will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;1. /*Generate a report on the proportion of: patients on any drug, patients with any physician visit, and patients on any drug or with any physician visit*/&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;/*Report the distribution of: number of physician visits per patient, number of patients per drugcode, number of patients per diagnostic grouping, and number of prescriptions per drugcode*/&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 13:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804373#M316751</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-03-27T13:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804388#M316755</link>
      <description>&lt;P&gt;There is no such thing as SAS code that will help you understand the questions.&amp;nbsp; Here is a set of preliminary questions to see if you might be able to approach these problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have one data set with patient information, or more than one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For each data set, do you know the name of the data set and the names of the variables it contains?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For each data set, does it contain one observation per patient or multiple observations per patient?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had the data printed on paper in front of you, how could you tell if a patient was on any drug, or a patient had a physician visit?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My apologies if these questions seem too easy, but I just have to make sure we are not skipping any basic ideas that you will need.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 14:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804388#M316755</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-03-27T14:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804390#M316757</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;Your questions are meaningful and I understand all these concept but I guess where I got confused is how to interpret the question into sascode. To answer your questions:&lt;BR /&gt;I have 3 dataset. Each data have a unique identifier. See data information below. So how could I interpret the questions into code with these information?&lt;BR /&gt;Data1: Patient Demographic Variables:&lt;BR /&gt;patient_id [numeric]&lt;BR /&gt;sex {‘M’,’F’,’U’}&lt;BR /&gt;race {0,1,2,3,4,5}&lt;BR /&gt;birthdt [character (8) mmddyyyy format]&lt;BR /&gt;Data 2: Prescription Variables:&lt;BR /&gt;patient_id [numeric]&lt;BR /&gt;fill_dt [character (6) yymmdd format]&lt;BR /&gt;pharmacyid [numeric]&lt;BR /&gt;drugcode [numeric]&lt;BR /&gt;pills [numeric]&lt;BR /&gt;Data 3: Medical Variables:&lt;BR /&gt;patientid [numeric]&lt;BR /&gt;servicedate [character (6) yymmdd format],&lt;BR /&gt;providerid [numeric]&lt;BR /&gt;source [character (3) format ‘aaa’]&lt;BR /&gt;servicecode [character (5) format ‘annnn’]&lt;BR /&gt;diagnosiscode1 [character (3) format ‘nnn’]&lt;BR /&gt;diagnosiscode2 [character (3) format ‘nnn’]&lt;BR /&gt;diagnosiscode3 [character (3) format ‘nnn’]&lt;BR /&gt;• There is one personal summary record per patient.&lt;BR /&gt;• There are multiple prescription records per patient.&lt;BR /&gt;• There are multiple medical records per patient.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 14:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804390#M316757</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-03-27T14:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804392#M316758</link>
      <description>&lt;P&gt;That's a good start.&amp;nbsp; Presumably your first data set contains one observation per patient, but the others may contain many observations per patient.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without writing any SAS code (yet), you might consider whether a patient was taking any medications.&amp;nbsp; One way to do that would be to examine the second data set and see if any of the fill dates are filled in.&amp;nbsp; To consider whether a patient had any doctor visits, you might examine the third data set and check whether any of the service dates are filled in.&amp;nbsp; These steps could conceivably find that a patient took many drugs, or had many doctor visits.&amp;nbsp; So the results from these checks would still need to reduce the results down to a single observation per patient with (perhaps) a Y/N result for "any drugs" and another Y/N result for "any visits".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on what you know, see if the related question (your original question #1) at least becomes approachable.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 15:10:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804392#M316758</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-03-27T15:10:52Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804409#M316765</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;Since I don't have a data for this analysis to visualize. If am to practice this, will i create a data step to check if &lt;SPAN&gt;any fill dates are filled in or service date are filled in&amp;nbsp;&lt;/SPAN&gt;?&lt;/P&gt;&lt;P&gt;Will this code works? I am not sure how to use date format in an if statement.&lt;/P&gt;&lt;P&gt;/*2nd data*/&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set&amp;nbsp;Prescription;&lt;/P&gt;&lt;P&gt;if fill_dt ne missing then pt_anydrug=1; else pt_anydrug=0;&amp;nbsp; /*how will i code fill_dt*?/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;/*3rd data*/&lt;/P&gt;&lt;P&gt;data want2;&lt;/P&gt;&lt;P&gt;set&amp;nbsp;Medical;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if &amp;nbsp;servicedate ne missing then pt_doctorvisits =1; else&amp;nbsp;pt_doctorvisits=0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 15:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804409#M316765</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-03-27T15:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804416#M316768</link>
      <description>&lt;P&gt;No data to practice with?&amp;nbsp; Wow.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With no data, I can't tell whether your variables are numeric or character.&amp;nbsp; So let's choose a syntax that would work either way:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(fill_dt) then pt_anydrug=0;
else pt_anydrug=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Similarly,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if missing(servicedate) then pt_doctorvisits=0;
else pt_doctorvisits=1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;One result that may show up later:&amp;nbsp; it is possible that you will get all 1 values and no 0 values.&amp;nbsp; For example, it is possible that the Medications data contains only drugs that were taken and does not contain any observations for patients that received no drugs.&amp;nbsp; Difficult to tell with no data!&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 17:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804416#M316768</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-03-27T17:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804428#M316780</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you. From my prior message&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fill_dt&amp;nbsp; is&amp;nbsp; [character (6) yymmdd format]&lt;/P&gt;&lt;P&gt;servicedate is&amp;nbsp;[character (6) yymmdd format]&lt;/P&gt;&lt;P&gt;Please any idea on how to address the second question and confused with how to code the "per patient" ?&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Report the distribution of: # of physician visits per patient, # of patients per drugcode, # of patients per diagnostic grouping, and # of prescriptions per drugcode.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Sun, 27 Mar 2022 19:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804428#M316780</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2022-03-27T19:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Report the distribution</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804437#M316786</link>
      <description>&lt;P&gt;You're right, you had already posted info about the characteristics of the variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the idea of what needs to happen for the second set of questions.&amp;nbsp; I will use the medication data as an example, since that is required for the most difficult question (number of patients per diagnostic code).&amp;nbsp; That data set contains many observations for some patients, perhaps 0 observations for some patients.&amp;nbsp; And with 3 diagnosis codes, you may need to assign a patient to more than one diagnosis.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, you need to create up to 3 observations for each existing observation (one observation per diagnosis code).&amp;nbsp; Once you have done that, you need to reduce that data set, eliminating duplicate occurrences of patient + diagnosis code.&amp;nbsp; Then you need to summarize it, getting just one observation per diagnosis code, with number of patients calculated.&amp;nbsp; As a learning experience, I would suggest you try your hand at this, and begin by looking up documentation on the OUTPUT statement.&amp;nbsp; After a while, it it becomes too difficult we can review what you came up with so far.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Mar 2022 20:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Report-the-distribution/m-p/804437#M316786</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-03-27T20:31:20Z</dc:date>
    </item>
  </channel>
</rss>

