<?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: Delete observations randomly based on percentage and impute them in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335868#M76075</link>
    <description>&lt;P&gt;suppose this is original data=&lt;/P&gt;&lt;P&gt;A B C D E&lt;/P&gt;&lt;P&gt;4 5 8 10 9&lt;/P&gt;&lt;P&gt;3 5 2&amp;nbsp; 6&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;8 9 3&amp;nbsp; 5&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;9 3 5&amp;nbsp; 6&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in out put data should be in this way. so later stages I can impute them.&lt;/P&gt;&lt;P&gt;A B C D E&lt;/P&gt;&lt;P&gt;4 5&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 9&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 6&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;8 9&amp;nbsp; 3 5&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;the data should be complete and there should be blank where we deleted values.&lt;/P&gt;&lt;P&gt;my original data is way bigger then this. please any help will be appreciated.&lt;/P&gt;</description>
    <pubDate>Sat, 25 Feb 2017 17:38:32 GMT</pubDate>
    <dc:creator>chintanpatel</dc:creator>
    <dc:date>2017-02-25T17:38:32Z</dc:date>
    <item>
      <title>Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335795#M76044</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am new to sas programming. I am doing data analysis. I want to delete observations(not collumn or raw) and then in output i need full data set in which it should show deleted value as missing so i can impute those values for later use.I want to delete observations randomly based on percentage. can anyone help me with code ?&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 01:32:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335795#M76044</guid>
      <dc:creator>chintanpatel</dc:creator>
      <dc:date>2017-02-25T01:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335798#M76045</link>
      <description>&lt;P&gt;1. CALL MISSING() can be used to set multiple variables to missing.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. If you need an exact sample use PROC SURVEYSELECT and merge back with original dataset to identify selected records. Or use the following if approximate is ok.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if rand('Bernoulli', 0.5) =1 then call missing(of _all_);&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 02:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335798#M76045</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-25T02:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335803#M76049</link>
      <description>&lt;P&gt;It is better to post an example to expalin what you want .&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 04:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335803#M76049</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-02-25T04:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335808#M76052</link>
      <description>&lt;P&gt;Here is an example based on sashelp.class of how to select a random sample of 20% from each sex group for &lt;EM&gt;deletion&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Sort by subgroups, if needed */
proc sort data=sashelp.class out=class; by sex; run;

/* Select sample in each subgroup */
proc surveyselect data=class out=classSample
    samprate=0.2 outall;
strata sex; /* subgroups */
run;

/* Set variables to missing for selected obs */
data classSample;
set classSample;
if selected then call missing(weight, height);
drop selected selectionProb samplingWeight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;note: you could generate 100 random samples by adding option &lt;STRONG&gt;reps=100&lt;/STRONG&gt; to the proc surveyselect statement. The variable &lt;STRONG&gt;replicate&lt;/STRONG&gt; would then be added to the output data.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 05:39:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335808#M76052</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-02-25T05:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335868#M76075</link>
      <description>&lt;P&gt;suppose this is original data=&lt;/P&gt;&lt;P&gt;A B C D E&lt;/P&gt;&lt;P&gt;4 5 8 10 9&lt;/P&gt;&lt;P&gt;3 5 2&amp;nbsp; 6&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;8 9 3&amp;nbsp; 5&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;9 3 5&amp;nbsp; 6&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in out put data should be in this way. so later stages I can impute them.&lt;/P&gt;&lt;P&gt;A B C D E&lt;/P&gt;&lt;P&gt;4 5&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 9&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 6&amp;nbsp; 8&lt;/P&gt;&lt;P&gt;8 9&amp;nbsp; 3 5&amp;nbsp; 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; 3&amp;nbsp; 5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;/P&gt;&lt;P&gt;the data should be complete and there should be blank where we deleted values.&lt;/P&gt;&lt;P&gt;my original data is way bigger then this. please any help will be appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 17:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335868#M76075</guid>
      <dc:creator>chintanpatel</dc:creator>
      <dc:date>2017-02-25T17:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335869#M76076</link>
      <description>&lt;P&gt;The term "observation" in sas means, ususally, a row in the dataset.&lt;/P&gt;
&lt;P&gt;Your output has same number of observation (rows) as input.&lt;/P&gt;
&lt;P&gt;You did not deleted observations but randomaly assign missing to variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should the percentage be of observations (rows) or of values ? which I'm not sure is the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 18:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335869#M76076</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-02-25T18:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335870#M76077</link>
      <description>&lt;P&gt;I want to delete random data values not the observations. and percentage should be depend on data values.if we think of 20%, out of 500 observations in every variable it should delete 100 data values. and out put should contain 500 observations in which deleted values should be blank or missing.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 18:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335870#M76077</guid>
      <dc:creator>chintanpatel</dc:creator>
      <dc:date>2017-02-25T18:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335875#M76080</link>
      <description>&lt;P&gt;Here is a possible method-code but I dont know what is the preffered randon functio&lt;/P&gt;
&lt;P&gt;in order to force the desired percantage:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n=5; /* number of observations-values per row */
%let p=0.05; /* desired percentage */
data want;
 set test(drop=F) end=eof;
     array obs {&amp;amp;n} _numeric_;
     retain nmis 0;

     do i=1 to &amp;amp;n;
        if round(ranuni(100),0.01) = &amp;amp;p
        then do; nmis+1; call missing(obs(i)); end;
     end;&lt;BR /&gt;     if eof then put nmis= " is the number of missing values created ";
     DROP i nmis;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Feb 2017 19:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335875#M76080</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-02-25T19:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335876#M76081</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;types faster than I do but, if you need to delete both character and numeric (which I presume you do as you mentioned that the results should either be missing or blank), the method can be expanded to include both:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  array nums(*) _numeric_;
  array chars(*) _character_;
  do _n_=1 to dim(nums);
    if rand("Uniform") lt .2 then call missing(nums(_n_));
  end;
  do _n_=1 to dim(chars);
    if rand("Uniform") lt .2 then call missing(chars(_n_));
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 19:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335876#M76081</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-25T19:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335889#M76088</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;You can use call Missing (of _all_) for both numeric and character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;'s code modified&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n=5; /* number of observations-values per row */
%let p=0.05; /* desired percentage */
data want;
 set test(drop=F) end=eof;
     retain nmis 0;


        if round(ranuni(100),0.01) = &amp;amp;p
        then do; 
                nmis+1; 
               call missing(of _all_);
        end;
       
        if eof then put nmis= " is the number of missing values created ";
     DROP i nmis;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or from PGStats solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let p=0.05;

proc sort data=sashelp.class out=class;
    by sex;
run;

proc surveyselect data=class out=selected samprate=&amp;amp;p outall;
    strata sex;
run;

data missing;
    set selected;

    if selected=1 then
        call missing (of _all);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:09:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335889#M76088</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-25T21:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335892#M76090</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;, using&amp;nbsp;&lt;STRONG&gt;call missing(of _ALL_)&lt;/STRONG&gt; - should it not enter missing values to &lt;STRONG&gt;all&lt;/STRONG&gt; variables in the observation ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Looking at wanted result of example, that is not the desired:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;in out put data should be in this way. so later stages I can impute them.
A B C  D E
4 5   10 9
3 2 6  8
8 9 3  5 7
  3 5    2&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335892#M76090</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-02-25T21:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335893#M76091</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;: I may be missing something, but&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;and I suggested code for deleting the values in a random selection of 20% of the cells, not deleting all values for 20% of the cases. &amp;nbsp;As such, I don't think call missing(of _all_) would be applicable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:20:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335893#M76091</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-25T21:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335895#M76092</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/88384"&gt;@Shmuel&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;You're correct, my mistake!&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335895#M76092</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-25T21:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335899#M76095</link>
      <description>&lt;P&gt;data RandClass(drop=i);&lt;BR /&gt;call streaminit(1234);&lt;BR /&gt;set sashelp.cars(keep=Cylinders Horsepower Enginesize);&lt;BR /&gt;array x {*} _numeric_;&lt;BR /&gt;do i = 1 to dim(x);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; if rand("Bern", 0.1) then&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* p=0.4 ==&amp;gt; about 40% missing */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x[i]=.; end;&lt;BR /&gt;run;&lt;BR /&gt;proc print;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;data sashelp;&lt;BR /&gt;set sashelp.cars;&lt;BR /&gt;update cars Randclass;&lt;BR /&gt;by Cylinders Horsepower Enginesize;&lt;BR /&gt;run;&lt;BR /&gt;proc print cars;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have removed data values randomly from three variables cylinders horsepower and enginesize from sashelp.cars. when i am trying to update newly created varaibles with missing value in data set sashelp.cars its giving me errors like&lt;/P&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67 data sashelp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 set sashelp.cars;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 update cars Randclass;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: File WORK.CARS.DATA does not exist.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 by Cylinders Horsepower Enginesize;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;proc print cars;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;____&lt;/DIV&gt;&lt;DIV class="sasError"&gt;22&lt;/DIV&gt;&lt;DIV class="sasError"&gt;202&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 22-322: Syntax error, expecting one of the following: ;, BLANKLINE, CONTENTS, DATA, DOUBLE, GRANDTOTAL_LABEL, GRANDTOT_LABEL,&lt;/DIV&gt;&lt;DIV class="sasError"&gt;GRAND_LABEL, GTOTAL_LABEL, GTOT_LABEL, HEADING, LABEL, N, NOOBS, NOSUMLABEL, OBS, ROUND, ROWS, SPLIT, STYLE,&lt;/DIV&gt;&lt;DIV class="sasError"&gt;SUMLABEL, UNIFORM, WIDTH.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 202-322: The option or parameter is not recognized and will be ignored.&lt;/DIV&gt;&lt;DIV class="sasError"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;can anyone help me in this errors which is coming when i am trying to update. half part is working correct even i am getting as an output randclass dataset with 3 variables. in the 2nd part when i am trying to update its giving me errors.&lt;/DIV&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335899#M76095</guid>
      <dc:creator>chintanpatel</dc:creator>
      <dc:date>2017-02-25T21:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335903#M76097</link>
      <description>&lt;P&gt;The error is clear, do you have a dataset CARS created, check your library? If not then check your code. I think you meant to create a dataset called CARS but you called it SASHELP instead?&amp;nbsp;Make sure you're consistent with the names used.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335903#M76097</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-25T21:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335904#M76098</link>
      <description>&lt;P&gt;Your code won't work for a number of reasons. For one you select every cell, as the random number will always be greater than 0, thus the condition will always be true.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, you never create the file cars but, rather, a file called sashelp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 21:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/335904#M76098</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-25T21:33:45Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/419895#M103285</link>
      <description>is it possible to delete a single observation? not the whole row? thanks!</description>
      <pubDate>Sun, 10 Dec 2017 07:49:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/419895#M103285</guid>
      <dc:creator>makojoyce</dc:creator>
      <dc:date>2017-12-10T07:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Delete observations randomly based on percentage and impute them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/419902#M103287</link>
      <description>&lt;P&gt;It depends on what you mean by&amp;nbsp;&lt;STRONG&gt;"&lt;SPAN&gt;&amp;nbsp;delete a single&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;observation&lt;/STRONG&gt;"&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;-&lt;/P&gt;
&lt;P&gt;up to know you asked to enter missing value to "observations" randomly.&lt;/P&gt;
&lt;P&gt;Do you mean to skip the missing value, still having same number of values per row (output observation) ?&lt;/P&gt;
&lt;P&gt;If positive then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let n=5; /* number of observations-values per row */
%let p=0.05; /* desired percentage */
data want;
 set test(drop=F) end=eof;
     array obs {&amp;amp;n} _numeric_;
     retain nmis 0;

     do i=1 to &amp;amp;n;
        if round(ranuni(100),0.01) = &amp;amp;p
        then do; 
               nmis+1; 
               call missing(obs(i)); 
               i = i - 1;   /* line added - leave space for next value */
        end;
     end;    
     if eof then put nmis= " is the number of missing values created ";
     DROP i nmis;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 10 Dec 2017 11:20:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-observations-randomly-based-on-percentage-and-impute-them/m-p/419902#M103287</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-12-10T11:20:18Z</dc:date>
    </item>
  </channel>
</rss>

