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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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