<?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 Deleting Variables with Only Missing Values from Dataset with 4000+ Variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494926#M33</link>
    <description>&lt;P&gt;Hello everyone and thank you in advance for your help!&amp;nbsp; This is my first post, so please forgive me if this is confusing or redundant.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each month, I receive a large dataset with around 4000+ variables and 3000+ observations.&amp;nbsp; The data is from 30 different centers, but I am only interested in the data from 3 centers. Some variables are the same for all centers, but variables are only linked to some of the centers.&amp;nbsp; I would like to get rid of the variables that have no values for the centers that I am interested in. I currently have a code that works, but I have to split my file into 6 lists of variables.&amp;nbsp;I feel like there must be a way to do this in one step without getting the messae "&lt;SPAN&gt;ERROR: The text expression length (65639) exceeds maximum length (65534). The text expression has been truncated to 65534"&amp;nbsp;&lt;/SPAN&gt;because I'm SURE people work with even larger datasets than mine!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have this current setup:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* To split up my dataset, I am using this code 
to find the names of the variables so I 
can create a list. The SAS Macro is able to
 handle only 800 variable names at a time. 
Otherwise I receive an error about macro 
variable size and truncation*/ 

proc contents data= &amp;amp;month noprint out=_contents_ order=varnum;
run;

proc sort data=_contents_;
by varnum; 
run; quit; 

proc print data=_contents_ ;
where varnum in (1, 2, 800, 801, 1600, 1601, 2400, 2401, 3200, 3201, 4000, 4386);
var name varnum;
run;

/*I change the LET statement to reflect the part of the list I am at */ 

%LET listnum0=CallReportNum ReportVersion--Zip_Code_Information___Did_you_a; 
%LET set1= iteration1; %LET set0= &amp;amp;month; 

/*this is the main part of the code that 
gets rid of the variables with no observations */

proc transpose data= &amp;amp;set0(obs=0) out= vname ;
 var &amp;amp;listnum0;
run;

proc contents data= vname order= varnum; 
run; quit; 

proc sql;
 select catx(' ','n(',_name_,') as ',_name_) into : list separated by ',' from vname;
 create table temp as
  select &amp;amp;list from &amp;amp;set0
;quit;

proc transpose data= temp out= drop ;
 var _all_;
run;

proc sql;
 select _name_ into : drop separated by ' ' from drop where col1= 0;
quit;

data &amp;amp;set1; 
 set &amp;amp;set0 (drop= &amp;amp;drop);
run;&lt;/CODE&gt;&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a simple fix&amp;nbsp;or creative workaround to this issue that I am unaware of?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Sep 2018 18:04:57 GMT</pubDate>
    <dc:creator>sabataged</dc:creator>
    <dc:date>2018-09-12T18:04:57Z</dc:date>
    <item>
      <title>Deleting Variables with Only Missing Values from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494926#M33</link>
      <description>&lt;P&gt;Hello everyone and thank you in advance for your help!&amp;nbsp; This is my first post, so please forgive me if this is confusing or redundant.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Each month, I receive a large dataset with around 4000+ variables and 3000+ observations.&amp;nbsp; The data is from 30 different centers, but I am only interested in the data from 3 centers. Some variables are the same for all centers, but variables are only linked to some of the centers.&amp;nbsp; I would like to get rid of the variables that have no values for the centers that I am interested in. I currently have a code that works, but I have to split my file into 6 lists of variables.&amp;nbsp;I feel like there must be a way to do this in one step without getting the messae "&lt;SPAN&gt;ERROR: The text expression length (65639) exceeds maximum length (65534). The text expression has been truncated to 65534"&amp;nbsp;&lt;/SPAN&gt;because I'm SURE people work with even larger datasets than mine!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I have this current setup:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* To split up my dataset, I am using this code 
to find the names of the variables so I 
can create a list. The SAS Macro is able to
 handle only 800 variable names at a time. 
Otherwise I receive an error about macro 
variable size and truncation*/ 

proc contents data= &amp;amp;month noprint out=_contents_ order=varnum;
run;

proc sort data=_contents_;
by varnum; 
run; quit; 

proc print data=_contents_ ;
where varnum in (1, 2, 800, 801, 1600, 1601, 2400, 2401, 3200, 3201, 4000, 4386);
var name varnum;
run;

/*I change the LET statement to reflect the part of the list I am at */ 

%LET listnum0=CallReportNum ReportVersion--Zip_Code_Information___Did_you_a; 
%LET set1= iteration1; %LET set0= &amp;amp;month; 

/*this is the main part of the code that 
gets rid of the variables with no observations */

proc transpose data= &amp;amp;set0(obs=0) out= vname ;
 var &amp;amp;listnum0;
run;

proc contents data= vname order= varnum; 
run; quit; 

proc sql;
 select catx(' ','n(',_name_,') as ',_name_) into : list separated by ',' from vname;
 create table temp as
  select &amp;amp;list from &amp;amp;set0
;quit;

proc transpose data= temp out= drop ;
 var _all_;
run;

proc sql;
 select _name_ into : drop separated by ' ' from drop where col1= 0;
quit;

data &amp;amp;set1; 
 set &amp;amp;set0 (drop= &amp;amp;drop);
run;&lt;/CODE&gt;&amp;nbsp;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is there a simple fix&amp;nbsp;or creative workaround to this issue that I am unaware of?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:04:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494926#M33</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T18:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494932#M34</link>
      <description>&lt;P&gt;@sabotaged Welcome to SAS forum. Would be nice to follow if you could state your objective/requirement before your code like&lt;/P&gt;
&lt;P&gt;My objective is to ...............&lt;/P&gt;
&lt;P&gt;The following code does it............&lt;/P&gt;
&lt;P&gt;The problem I am encountering....&lt;/P&gt;
&lt;P&gt;Any solutions plz....................&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 17:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494932#M34</guid>
      <dc:creator>MarkWik</dc:creator>
      <dc:date>2018-09-12T17:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494934#M35</link>
      <description>&lt;P&gt;Are the missing variables likely to be character or numeric?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is actually asked pretty frequently, so a search generates several ready made solutions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;User group paper:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings10/048-2010.pdf" target="_blank"&gt;http://support.sas.com/resources/papers/proceedings10/048-2010.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Previous question here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Getting-rid-of-all-variables-for-which-there-are-ONLY-missing/td-p/172713" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/Getting-rid-of-all-variables-for-which-there-are-ONLY-missing/td-p/172713&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS Note:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/24/622.html" target="_blank"&gt;http://support.sas.com/kb/24/622.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 17:35:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494934#M35</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-12T17:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494935#M36</link>
      <description>&lt;P&gt;Observation is the word used for one record (or row) in a SAS dataset. So every variable in a dataset has the same number of observations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you mean that you want find out which variables have only missing values?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have any numeric variables? If so does it matter if the variable has some observations with special missing values, like .A or .Z?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also why do you want eliminate them?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 17:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494935#M36</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-12T17:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494936#M37</link>
      <description>Hi, thanks so much for your reply. To answer your first question, there are both character and numeric variables, and there are a fair amount of both types dispersed throughout the document. As for the links you referenced, thank you so much, but I actually already looked through these (and many other) solutions before posting. I tried to use the %dropmiss macro last week, but was unable to successfully use it. After searching a lot of forum Q&amp;amp;A, I found a version of the main code that I posted in my original question. It works, but I have to split my dataset into 6 lists and run the code until I get through all the variables. I'm just wondering if there's any way to get around the message "ERROR: The text expression length (65639) exceeds maximum length (65534). The text expression has been truncated to 65534". I also researched about this error, but wasn't able to find a true workaround. I tried to change the size of the macro variable, but that didn't work either. Thanks again for your help! I apologize if I'm missing something that is otherwise obvious!</description>
      <pubDate>Wed, 12 Sep 2018 17:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494936#M37</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T17:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494937#M38</link>
      <description>Hi, thank you for your reply! I'll try to edit my post to make it clearer.</description>
      <pubDate>Wed, 12 Sep 2018 17:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494937#M38</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T17:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494938#M39</link>
      <description>&lt;P&gt;The limitation of that approach is the requirement to use macro variables.&amp;nbsp; So don't use macro variables.&amp;nbsp; It is probably easier to just generate code a text file instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Get list of variables ;
proc transpose data=&amp;amp;month (obs=0) out=names ;
   var _all_;
run;

* Generate code to count non-missing values ;
filename code temp;
data _null_;
   file code ;
   set names end=eof;
   if _n_=1 then put
 'proc sql noprint;'
/'create table _counts as select' 
/' ' @
  ; else put ',' @ ;
  put 'sum(not missing(' _name_ ')) as ' _name_ ;
  if eof then put
 'from &amp;amp;month'
/';'
/'quit;'
  ;
run;

* Run generated code ;
%include code / source2 ;

* Generate DROP statement ;
filename code temp;
data _null_;
  set _counts ;
  array c _numeric_;
  file code lrecl=80 ;
  length _name_ $32 ;  
  put 'drop ' @;
  do _n_=1 to dim(c);
   if c(_n_)=0 then do ;
     _name_ = vname(c(_n_));
     put _name_ @ ;
  end;
  end;
  put ';' ;
run;

* Make version of data without empty variables ;
data &amp;amp;set1 ;
  set &amp;amp;month ;
  %include code / source2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 17:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494938#M39</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-12T17:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494939#M40</link>
      <description>Hi Tom, thanks for the reply. To answer your questions: 1. Yes, I would like to delete variables with only missing values. Sorry for the misuse of terminology! I will edit my post to reflect the correct term. 2. I have both numeric and character variables in my dataset. I'm just interested in getting rid of variables with all missing values. I don't have any special missing values, I think. 3. Each month, I receive a dataset that contains variables and records from 30 different centers. There are both character and numeric variables. I am only interested in the variables from 3 centers, so I'd like to delete the rest of the variables that are linked to other centers. After going through the process of cleaning the dataset, I end up with around 300 variables from the original 4000+ variables.</description>
      <pubDate>Wed, 12 Sep 2018 17:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494939#M40</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T17:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494941#M41</link>
      <description>&lt;P&gt;Sounds like missing status has nothing to do with the request.&amp;nbsp; Perhaps I misunderstood your original code.&lt;/P&gt;
&lt;P&gt;So you just want to keep variables related to the selected centers?&lt;/P&gt;
&lt;P&gt;How do you know which variables are related to which center?&lt;/P&gt;
&lt;P&gt;How do you know which centers you want to keep?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494941#M41</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-12T18:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494943#M42</link>
      <description>Hi Tom, I wish I could upload the original Excel file, but it has patient information in it. There are 4000+ variables, but many of the variables don't have any data in them for any center. The rest of the variables have information in them, but only for certain centers. I don't have any way of telling which variables are related to which center, so that's why it would really help to get rid of variables with no values. I know which centers I want to keep because we are interested in the data from only 3 specific centers.</description>
      <pubDate>Wed, 12 Sep 2018 18:13:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494943#M42</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T18:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494945#M43</link>
      <description>&lt;P&gt;It does not need to be real data. Make fake data that has the same structure and issues as the real data. Yes this takes work but you'll get an answer much faster so in the long run you save time.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:17:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494945#M43</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-09-12T18:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494947#M44</link>
      <description>Also just make data with a few columns.  We don't need 4000 columns to generate test code.&lt;BR /&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494947#M44</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-12T18:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494950#M45</link>
      <description>&lt;P&gt;Do you have a CENTER variable you can use to find the&amp;nbsp;centers&amp;nbsp;you want to keep?&lt;/P&gt;
&lt;P&gt;If so you could just add a first step to subset the observations (rows) to just the centers of interest.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data step1 ;
  set &amp;amp;month ;
  where center in (......);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use that dataset as the input to the code I posted and it will eliminate the columns that are all empty for just that subset of the rows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:24:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494950#M45</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-12T18:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494960#M46</link>
      <description>Hi Tom, I just noticed the code you posted earlier! I was trying to make the process faster by using the "LET" statement, but that might be what is causing the issue. Yes, I do have a "center" variable, and the first thing I do is write a data step that keeps only the observations from those centers. Anyhow, I will try and incorporate the code that you posted now. Thank you very much!</description>
      <pubDate>Wed, 12 Sep 2018 18:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494960#M46</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T18:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494962#M47</link>
      <description>Hi Reeza, I will try and do that next time for easier visualization. Thank you for the tip!</description>
      <pubDate>Wed, 12 Sep 2018 18:36:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494962#M47</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T18:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with Only Missing Values from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494975#M48</link>
      <description>&lt;P&gt;How do you bring the data set into SAS?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the file structure does not change then using a data step with appropriate IF statement to keep the records for the centers you are interested in and a KEEP or DROP&amp;nbsp;statement to only have the variables you want might be the best approach in the long run. It sounds like you already know which variables you want to keep so should not be too hard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a project that shares mostly common variables with some other organizations which have a few fields my data does not need. DROP statement takes care of that just fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:49:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494975#M48</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-12T18:49:27Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with Only Missing Values from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494981#M49</link>
      <description>I use proc import to bring in an Excel file. Unfortunately, the data structure changes each month! They keep adding/deleting variables, so I have no idea of knowing what to look for each time. There are a few core variables that are supposed to always stay the same, but they change the name of these variables sometimes. For example, in January, they named the gender column as "Gender" and in February they decided to change it to "Sex" and in March it became "GenderOfPatient". We have asked the centers to stay consistent, but not all of them listen. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;</description>
      <pubDate>Wed, 12 Sep 2018 18:55:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494981#M49</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T18:55:24Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with Only Missing Values from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494985#M50</link>
      <description>I use proc import to bring in an Excel file. Unfortunately, the data structure changes each month! They keep adding/deleting variables, so I have no idea of knowing what to look for each time. There are a few core variables that are supposed to always stay the same, but they change the name of these variables sometimes. For example, in January, they named the gender column as "Gender" and in February they decided to change it to "Sex" and in March it became "GenderOfPatient". We have asked the centers to stay consistent, but not all of them listen.</description>
      <pubDate>Wed, 12 Sep 2018 18:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/494985#M50</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T18:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with No Observations from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/495004#M51</link>
      <description>&lt;P&gt;Tom, you are a genius! Thank you SO much for your help!&amp;nbsp; This is exactly what I needed.&amp;nbsp; Sending you many, many positive vibes. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 19:50:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/495004#M51</guid>
      <dc:creator>sabataged</dc:creator>
      <dc:date>2018-09-12T19:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting Variables with Only Missing Values from Dataset with 4000+ Variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/495062#M52</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83762"&gt;@sabataged&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I use proc import to bring in an Excel file. Unfortunately, the data structure changes each month! They keep adding/deleting variables, so I have no idea of knowing what to look for each time. There are a few core variables that are supposed to always stay the same, but they change the name of these variables sometimes. For example, in January, they named the gender column as "Gender" and in February they decided to change it to "Sex" and in March it became "GenderOfPatient". We have asked the centers to stay consistent, but not all of them listen. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This sounds like it might be a case of getting management involved.&lt;/P&gt;
&lt;P&gt;Any time data is to be shared between organizations, even parts of a single organization, it helps everyone if an actual formal agreement is made as to content, order and values of variables is done. That way you head off these headaches and can develop a process that is 1) reliable and 2) likely to save time and money.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used to work for a company that did some contract work involving another companies data. When I got&amp;nbsp;involved with that project I had to respond to the clients question about why there was a programming charge almost every month. When I explained that we had been receiving the data in different column order and that we had to modify the data to work for the project the client realized &lt;STRONG&gt;his budget&lt;/STRONG&gt; was negatively affected because someone in his organization had not developed a standard approach. They fixed that and cut the cost of the project by about 5%. (And my programmer thanked me for not having to deal with the stupidity involved).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Document how much time it takes to fix this one time. Get a cost estimate from that time. Go to management with that information and frequency and you may see movement quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Relying on the combination of Excel and Proc Import in production work is a recipe for multiple headaches.&lt;/P&gt;
&lt;P&gt;Since proc import has to guess as to the field size and type after examining a very few rows of data you can have variables change lengths and type from month to month. Which means when those periodic data sets get combined for any reason you can have issues with 1) not combining at all due to errors&amp;nbsp;if a field changes from character to numeric and 2) loss of data for character values due to varying lengths.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Save to CSV, use a data step to read data is much more predictable.&lt;/P&gt;
&lt;P&gt;And in your case, the selection of data for specific&amp;nbsp;centers and variables&amp;nbsp;would stay the same.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I deal with anywhere from 10 to 30 Excel files per month. I save them to CSV format and use data steps to import them so the variable names, types, lengths and formats stay the same. That way when I combine the data across sites/ organizations I don't have issues related to different lengths and the process goes pretty smooth.&lt;/P&gt;
&lt;P&gt;Plus if a field is supposed to be numeric and some idiot has entered text in the Excel file I get invalid data notices in the log I can use to back track to a source if needed.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2018 21:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Deleting-Variables-with-Only-Missing-Values-from-Dataset-with/m-p/495062#M52</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-12T21:57:51Z</dc:date>
    </item>
  </channel>
</rss>

