04-04-2017 05:11 AM
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 .
04-04-2017 05:57 AM
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.
04-04-2017 06:25 AM
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
04-04-2017 06:30 AM
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.
04-04-2017 09:09 AM
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
04-04-2017 09:17 AM - edited 04-04-2017 09:33 AM
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;
04-04-2017 06:14 AM
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;
04-04-2017 06:32 AM
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:
But that is much more likely to cause downstream problems.
04-04-2017 10:21 AM
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.