BookmarkSubscribeRSS Feed
ambadi007
Quartz | Level 8

Dear experts,

 

I have a requirement from my client that need to populate a blank column but that should not be having any spaces or periods (full blank)

I know SAS can show this as either space or periods, but wanted to know is there any other soultion for this .

 

Thanks

 

Manesh

9 REPLIES 9
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Erm, your question is very unclear.  This:

data want;
  a="";
run;

Creates a dataset with one emtpy variable named a (length 1).  Dots (.) are a feature of missing numerics, you can change this with options missing="";

Wouldn't recommend that though as it affects everything in the session.  Just create an emtpy string variable as above, length is irrelevant.  Cant see why spaces would matter.

ambadi007
Quartz | Level 8

Hi,

I created the variable like this a=' '; But this creating a space in the report, this gives errors while exporting the report from client system , so they need a complete blank instead of the space or periods.Thanks

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, you will need to be far more specific - give examples (plain text in the post).  What report, what file format?  how are you creating it? If you look at the example I provided there was no space between the quote marks, in your post there is.  Remove that space.

ambadi007
Quartz | Level 8

Hi ,

 

I am using excel file to report it and I am exporting the file using DDE program. but for the blanks columns it should not show the space , now if I use the a="" it shows the space in the column cells , and If I use the backspace key it is removing the space. My requirement is is there any solution to remove the space. Hope now its  clear

Tom
Super User Tom
Super User

Create a simple example that demonstrates the method you are using to export the data. DDE is not a normal method to use, Microsoft probably doesn't even want to support it anymore.

 

It is not hard to make a report with empty columns. For example a CSV file.

data _null_;
   file log dsd ;
   length var1-var3 $10;
   var1='A';
   var2=' ';
   var3='C';
   put var1-var3 ;
run;  

Reading the examples of DDE in this document http://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/viewer.htm#ddeexamples.htm

it looks like it should be simple.

filename mydata dde 'excel|sheet1!r10c1:r20c3' notab;
data _null_; 
   file mydata dsd dlm='09'x  ;
   set mysas;
   put (_all_) (+0);
run;

 

Ksharp
Super User
proc format;
value fmt .='NA';
value $fmt ' '='NA';
run;
data x;
 x='sds';y=23;output;
 x=' ';y=34;output;
 x='dsd';y=.;output;
 format _numeric_ fmt. _character_ $fmt.;
run;
proc print;run;
run;
Astounding
PROC Star

Technically, the answer is no.  You cannot create a character variable with length zero.

 

Conceivably, you could assign a null value to a character variable with code along these lines:

 

newvar='00'x;

 

But that is much more likely to cause downstream problems.

ambadi007
Quartz | Level 8

Hi This is affecting all other data

ballardw
Super User

If you do not want anything in column C, for example, then do not write anything to column C. Write to B, Write to D but do not write to C. Then C will be "blank" as in whatever default Excel wants it.

 

 

Simple.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 8081 views
  • 0 likes
  • 6 in conversation