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
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.
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
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.
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
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;
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;
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.
Hi This is affecting all other data
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.