{"id":5372,"date":"2017-03-25T20:23:41","date_gmt":"2017-03-26T01:23:41","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=5372"},"modified":"2017-04-26T13:58:00","modified_gmt":"2017-04-26T18:58:00","slug":"how-to-compute-a-standard-deviation-and-control-chart-when-you-dont-have-raw-data","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/how-to-compute-a-standard-deviation-and-control-chart-when-you-dont-have-raw-data\/","title":{"rendered":"How to compute a standard deviation and control chart when you don&#8217;t have raw data"},"content":{"rendered":"<div>It ought to be easier than this and perhaps I could have found an easier way if I had more patience than the average ant or very young infant. However, I don&#8217;t.<\/div>\n<div><\/div>\n<div>Here was the problem. I wanted control charts for two different variables, satisfaction with care, surveyed at discharge, and satisfaction with care 3 months after discharge.<\/div>\n<div><\/div>\n<div>The data was given in the form of the number of patients out of a sample of 500 who reported being unsatisfied. PROC SHEWHART does not have a WEIGHT\u00a0statement. You could try using the WEIGHT statement in PROC MEANS but that won&#8217;t work. It will give you the correct means if you have the number unsatisfied (undisc = 1) \u00a0and the number satisfied (undisc =0) out of 500, but the incorrect standard deviation because the N will be 2, according to SAS.<\/div>\n<div><\/div>\n<div>So, here is what I did and it was not elegant but it did work.<\/div>\n<ol>\n<li>I created two data sets, named q4disc and q4disc3, keeping the month of discharge and the number dissatisfied at discharge and dissatisfied 3 months later, respectively.<\/li>\n<li>I read in the 3 values I was given, month of sample, number unsatisfied at discharge and number unsatisfied 3 months later.<\/li>\n<li>Now, I am going to create a data set\u00a0of raw data based on the numbers I have. First, in a do loop, for as many as people said they were unsatisfied, I set the value of undisc (unsatisfied at discharge) to to 1\u00a0and output a record to the q4disc dataset.<\/li>\n<li>Next, in a do loop for 500- the number dissatisfied, I set undisc = 0 and output a record to the same dataset.<\/li>\n<li>Now, repeat steps 3 &amp; 4 to create a data set of the values of people unhappy 3 months after discharge.<\/li>\n<li>Following the programming statements are the original data.<\/li>\n<\/ol>\n<p>So, now, I have created two data sets of 6,000 records each with three variables. Doesn&#8217;t seem that efficient of a way to do it but now I have the data I need and it didn&#8217;t take long and doesn&#8217;t take up much space.<\/p>\n<div><\/div>\n<div>data q4disc (keep = undisc month) q4disc3 (keep = undisc3 month) ;<\/div>\n<div>input month $ discunwt disc3unwt ;<\/div>\n<div>Do I = 1 to discunwt ;<\/div>\n<div>\u00a0 \u00a0 undisc = 1 ;<\/div>\n<div>\u00a0 \u00a0 output q4disc ;<\/div>\n<div>end ;<\/div>\n<div>Do J = 1 to (500-discunwt) ;<\/div>\n<div>\u00a0 \u00a0undisc = 0 ;<\/div>\n<div>\u00a0 \u00a0output q4disc;<\/div>\n<div>end ;<\/div>\n<div>Do k = 1 to disc3unwt ;<\/div>\n<div>\u00a0 \u00a0undisc3 = 0 ;<\/div>\n<div>\u00a0 \u00a0output q4disc3 ;<\/div>\n<div>End ;<\/div>\n<div>Do x = 1 to (500 -disc3unwt) ;<\/div>\n<div>\u00a0 undisc3 = 1 ;<\/div>\n<div>\u00a0 \u00a0output q4disc3;<\/div>\n<div>end;<\/div>\n<div>datalines ;<\/div>\n<div>JAN 24 17<\/div>\n<div>FEB 44 24<\/div>\n<div>MAR 36 15<\/div>\n<div>APR 18 8<\/div>\n<div>MAY 16 11<\/div>\n<div>JUN 19 7<\/div>\n<div>JUL 17 11<\/div>\n<div>AUG 18 9<\/div>\n<div>SEP 27 10<\/div>\n<div>OCT 26 15<\/div>\n<div>NOV 29 12<\/div>\n<div>DEC 26 11<\/div>\n<div>;<\/div>\n<div>RUN ;<\/div>\n<div><\/div>\n<div>proc shewhart data=WORK.Q4disc;<\/div>\n<div>xschart undisc * month \/;<\/div>\n<div>run;<\/div>\n<div><\/div>\n<div><a href=\"http:\/\/support.sas.com\/documentation\/cdl\/en\/qcug\/63964\/HTML\/default\/viewer.htm#qcug_shewhart_a0000003855.htm\">According to SAS<\/a><\/div>\n<div>\n<p>&#8220;The XSCHART statement creates <img decoding=\"async\" class=\"math gen\" src=\"http:\/\/support.sas.com\/documentation\/cdl\/en\/qcug\/63964\/HTML\/default\/images\/qcug_shewhart0003.png\" alt=\"\" \/> and <img decoding=\"async\" class=\"math gen\" src=\"http:\/\/support.sas.com\/documentation\/cdl\/en\/qcug\/63964\/HTML\/default\/images\/qcug_shewhart0005.png\" alt=\"\" \/> charts for subgroup means and standard deviations, which are used to analyze the central tendency and variability of a process.&#8221;<\/p>\n<p>For the three months after discharge variable, just do another PROC SHEWHART with q4disc3 as the dataset and undisc3 as the measurement variable.<\/p>\n<\/div>\n<p>OR , once you have the dataset created, you can get the chart using SAS Studio by selecting the CONTROL CHARTS task<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/sas_studio_control.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5374\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/sas_studio_control.jpg\" alt=\"Control charts window with month as subgroup and undisc as measure\" width=\"456\" height=\"591\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/sas_studio_control.jpg 456w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/sas_studio_control-231x300.jpg 231w\" sizes=\"auto, (max-width: 456px) 100vw, 456px\" \/><\/a><\/p>\n<p>Either way will give you this result:<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-24-at-7.48.38-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5375\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-24-at-7.48.38-PM.png\" alt=\"Control chart\" width=\"450\" height=\"415\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-24-at-7.48.38-PM.png 450w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-24-at-7.48.38-PM-300x277.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/sites.fastspring.com\/7generation\/product\/fishlake\">Support my day job AND get smarter. Buy Fish Lake for Mac or Windows. Brush up on math skills and canoe the rapids.<\/a><\/p>\n<p><a href=\"http:\/\/sites.fastspring.com\/7generation\/product\/fishlake\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5385\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/04\/fishlakecanoe.jpg\" alt=\"girl in canoe\" width=\"450\" height=\"320\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/04\/fishlakecanoe.jpg 450w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2017\/04\/fishlakecanoe-300x213.jpg 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.youtube.com\/channel\/UC8zFOKXiyTvzei_bzj9WmaA\">For random advice from me and my lovely children, subscribe to our youtube channel 7GenGames TV<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It ought to be easier than this and perhaps I could have found an easier way if I had more patience than the average ant or very young infant. However, I don&#8217;t. Here was the problem. I wanted control charts for two different variables, satisfaction with care, surveyed at discharge, and satisfaction with care 3&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9,11,8],"tags":[],"class_list":["post-5372","post","type-post","status-publish","format-standard","hentry","category-software","category-statistics","category-technology"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/5372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/comments?post=5372"}],"version-history":[{"count":3,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/5372\/revisions"}],"predecessor-version":[{"id":5397,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/5372\/revisions\/5397"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=5372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=5372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=5372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}