DATA Step, Macro, Functions and more

missing values

Reply
Contributor
Posts: 27

missing values

[ Edited ]

Salve,

 

sto utilizzando SAS Data Integration Studio per scrivere, in un file di testo (.txt), alcuni campi letti da una tabella Oracle.

I valori dei campi scritti nel file sono racchiusi tra i doppi apici “ e “ e separati dal carattere ; ad esempio:

 

"TO_20147521221127";"4293675";"70419/ES";"1";"2";"42.00";"0.00";"0.00";"07MAR2015:00:00:00";"14FEB2015:00:00:00";".";"0";"0";".";"TO_21221127";"150.30";".";"13APR2015:16:01:56";" "

 

Ho evidenziato in nero l'ultimo e il penultimo campo.

L'ultimo campo, di tipo Numeric, è valorizzato con l’espressione: IFN(2=1,ID_FACTOR, ., .)

Il penultimo campo, di tipo Character, è invece valorizzato con l’espressione: IFC(2=1,"ID_FACTOR", "", "")

 

Poiché la condizione 2=1 è sempre falsa, entrambi i campi non saranno mai valorizzati con ID_FACTOR. Ma vorrei che tali campi siano scritti nel file entrambi con “”, anziché con "." e " " come mostrato nell’ esempio.

In altre parole, come potrei cambiare le espressioni per un campo Numeric e per un campo Character, evitando che nel file compaia “.” e “ “, ma facendo in modo che nel file sia scritto “” ?

 

Grazie,

Super User
Posts: 6,946

Re: campi non valorizzati

Since there is not yet an Italian regional group here, I strongly suggest you post your question in English, as it will attract a larger pool of possible helpers.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 27

Re: missing values

[ Edited ]
Hello,

 

I'm using SAS Data Integration Studio to write, in a text file (.txt), some fields read from an Oracle table.
Field values ​​written to the file are enclosed in double quotes " and " and separated by the character ; eg:

 

"TO_20147521221127";"4293675";"70419/ES";"1";"2";"42.00";"0.00";"0.00";"07MAR2015:00:00:00";"14FEB2015:00:00:00";".";"0";"0";".";"TO_21221127";"150.30";".";"13APR2015:16:01:56";" "

 

I highlighted in red the last and the third to last field. The last field, of Numeric type, is enhanced with the expression:

IFN(2=1,ID_FACTOR, ., .)

The third to last field, of type Character, is instead enhanced with the expression: 

IFC(2=1,"ID_FACTOR", "", "")
Since the condition 2 = 1 is always false, both fields will never be emphasized by using ID_FACTOR. But I wish that these fields are written to the file either with "", instead of "." and " " as shown in the example.
In other words, how could I change the expressions for a Numeric and a Character field, avoiding "." and " ", but to write " " in the file ?

 

Many thanks.

Super User
Posts: 6,946

Re: missing values

You will always get one blank, but

options missing = ' ';

will display a blank instead of the dot for missing numeric values.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 27

Re: missing values

Hi KurtBremser,

 

it doesn't work because the missing numbers are valued as " " and not with "" as I would like.

 

I've tried with:

 

options missing = ' ';

and with:

 

 

options missing = '';

but the output in the file is " " for blanks and not "". 

Ask a Question
Discussion stats
  • 4 replies
  • 209 views
  • 0 likes
  • 2 in conversation