Shiv_K Tracker
https://communities.sas.com/kntur85557/tracker
Shiv_K TrackerWed, 11 Sep 2024 13:46:38 GMT2024-09-11T13:46:38ZRe: How do I calculate missing values from available values in a variable?
https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-missing-values-from-available-values-in-a/m-p/843314#M333408
<P>Thank you for providing the solution promptly.</P>Wed, 09 Nov 2022 10:27:56 GMThttps://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-missing-values-from-available-values-in-a/m-p/843314#M333408Shiv_K2022-11-09T10:27:56ZHow do I calculate missing values from available values in a variable?
https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-missing-values-from-available-values-in-a/m-p/843080#M333345
<P>Hi,</P><P> </P><P>I have the following data:</P><P> </P><TABLE><TBODY><TR><TD>Size</TD><TD>Value</TD></TR><TR><TD>1</TD><TD> . </TD></TR><TR><TD>2</TD><TD> . </TD></TR><TR><TD>3</TD><TD> 8.00</TD></TR><TR><TD>4</TD><TD> 7.40</TD></TR><TR><TD>5</TD><TD> 7.20</TD></TR><TR><TD>6</TD><TD> . </TD></TR><TR><TD>7</TD><TD> . </TD></TR><TR><TD>8</TD><TD> . </TD></TR><TR><TD>9</TD><TD> 6.80</TD></TR><TR><TD>10</TD><TD> . </TD></TR><TR><TD>11</TD><TD> . </TD></TR><TR><TD>12</TD><TD> 5.90</TD></TR><TR><TD>13</TD><TD> . </TD></TR><TR><TD>14</TD><TD> . </TD></TR><TR><TD>15</TD><TD> . </TD></TR></TBODY></TABLE><P> </P><P>I want to calculate the missing values from the available values. For instance, values for sizes 1 and 2 are missing. The nearest available values are for sizes 3 and 4, and the values are 8.00 and 7.40. The difference in these sizes is 1 and the difference in the value is 0.60. Therefore the value of size 2 is 8.60 (that is, value of preceding size 3 at 8.00 plus the difference of 0.60) and the value of size 1 is 9.20 (that is, value of size 2 at 8.60 plus difference of 0.60). Similarly the values of sizes 6, 7 and 8 are calculated from the available values of sizes 5 and 9 as follows. The difference in the sizes is 4 and the difference of available values is 0.40 (that is, the size 5 value is 7.20 and size 9 value is 6.80) and the difference per size is 0.10 (that is, 0.40 divided by 4). Therefore the values of 6, 7 and 8 are 7.10, 7.00 and 6.90 respectively. The result will be like this.</P><P> </P><TABLE><TBODY><TR><TD>Size</TD><TD>Value</TD></TR><TR><TD>1</TD><TD> 9.20</TD></TR><TR><TD>2</TD><TD> 8.60</TD></TR><TR><TD>3</TD><TD> 8.00</TD></TR><TR><TD>4</TD><TD> 7.40</TD></TR><TR><TD>5</TD><TD> 7.20</TD></TR><TR><TD>6</TD><TD> 7.10</TD></TR><TR><TD>7</TD><TD> 7.00</TD></TR><TR><TD>8</TD><TD> 6.90</TD></TR><TR><TD>9</TD><TD> 6.80</TD></TR><TR><TD>10</TD><TD> 6.50</TD></TR><TR><TD>11</TD><TD> 6.20</TD></TR><TR><TD>12</TD><TD> 5.90</TD></TR><TR><TD>13</TD><TD> 5.60</TD></TR><TR><TD>14</TD><TD> 5.30</TD></TR><TR><TD>15</TD><TD> 5.00</TD></TR></TBODY></TABLE><P> </P><P>Will someone please let me know how to write a program for this in SAS 9.4?</P><P> </P><P>Thanks.</P><P> </P>Tue, 08 Nov 2022 10:50:09 GMThttps://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-missing-values-from-available-values-in-a/m-p/843080#M333345Shiv_K2022-11-08T10:50:09Z