|
I've never seen such a thing with PRINTING! Reading data, ok, that's
sometimes a problem.
Are you sure, that there are no strange (invisible) characters in the field
instead of a blank? That's what I assume!
Perhaps you could try to print that obs and variable with a $hex format, or
browse the raw-file with a hex-browser or editor to see whats in. If you
identify something strange, you should use COMPRESS with all the wrong chars
to remove them.
On Thu, 23 Feb 2006 07:30:52 -0800, A Pal <nbertest@YAHOO.COM> wrote:
>Hi All,
>
> MISSOVER and TRUNCOVER are giving the same result.
> There is no "INPUT went to a new line..." in the log. The data is reading
successfully so that
>
> proc print;
> var contract_id -- step_ther_yn ; ** everything but the drug_name ;
>
> looks correct and normal:
>
> 8 H0104 00001356 9 00002950501 1 N N N
> 9 H0104 00001356 9 00002721701 1 N N N
> 10 H0104 00001356 9 00013105602 1 N N N
> 11 H0104 00001356 9 00006494300 1 N N N
>
> but printing drug_name only seems to produce an overwrite like below:
>
> proc print;
> var drug_name;
>
> 8 CEFAZOLIN SODIUM
> 9 HEPARIN SODIUM
>
> PNEUMOVAX 23
>
> ( Note, no Obs for 10 and 11 ).
>
> Thanks so much for help!
>
> Jyan
>
> Gerhard Hellriegel <ghellrieg@T-ONLINE.DE> wrote: did you try the infile -
option MISSOVER or TRUNCOVER?
>
>...
>infile xxx dlm="|" missover;
>...
>
>that should prevent the input statement to read a new line, if there is no
>data left.
>Did you see any "INPUT went to a new line..." ?
>
>
>
>
>On Thu, 23 Feb 2006 06:40:19 -0800, A Pal wrote:
>
>>Hi All,
>>
>> Thank you all so much for the helpful responses! Using the : in the input
>> statement for the NDC code variable cause the tier variable to be read
>> correctly.
>>
>> I also have a question about how to read the drug name variable. It is
>> the last variable in the medicare public use formulary data file. It ends
>with
>> a line feed \n character, and if there is no drug name, then the value is
>a single
>> space. I am reading it with drug_name : $40. in the input statement. The
>> problem I find is that raw data like this:
>>
>> H0104|00001356|9|00002950501|1|N|N|N|CEFAZOLIN SODIUM
>> H0104|00001356|9|00002721701|1|N|N|N|HEPARIN SODIUM
>> H0104|00001356|9|00013105602|1|N|N|N|
>> H0104|00001356|9|00006494300|1|N|N|N|PNEUMOVAX 23
>>
>> is displayed by PROC PRINT like this:
>>
>> 8 H0104 00001356 9 00002950501 1 N N N CEFAZOLIN SODIUM
>> H0104 00001356 9 00002721701 1 N N N HEPARIN SODIUM
>> 6 9 00013105602 1 N N N
>> 0104 00001356 9 00006494300 1 N N N PNEUMOVAX 23
>>
>> ( The leading '8' is the Obs ). The variables are all seeming to be read
>> correctly. However, the drug_name variable seems to be overwriting the
>> subsequent line. Another analyst, not sure who but probably not experienced
>> with SAS, will be running this program each month when the data is updated.
>> So I would like that person to have no surprise when they run this program.
>> ( I tried using a length drug_name $40 ; prior to the infile statement. I
>can verify via proc contents that SAS is implementing it, however,it doesn't
>seem to be helping. ). Have others encountered a problem like this and
>solved it?
>>
>> Thanks,
>>
>> Jyan
>>
>>Jiann-Shiun Huang wrote: Jyan:
>>
>> I believe the problem is in the input statement:
>>
>>input contract_id $ formulary_id $ formulary_version ndc $11. cheesy
>>tier
>> quantity_limit_yn $ prior_auth_yn $ step_ther_yn $ drug_name : $40. ;
>>
>>You use list input to get your variable values and hence you should
>>have a colon between "ndc" and "$11.". With the change above and take
>>out cheesy from the input statement, the input statement is:
>>
>>input contract_id $ formulary_id $ formulary_version ndc:$11. tier
>> quantity_limit_yn $ prior_auth_yn $ step_ther_yn $ drug_name : $40. ;
>>
>> Without ":" between "ndc" and "$11.", the column pointer stops at "|"
>>for the next input. That is why your "cheesy" variable get a missing
>>value since a nonnumeric value is tried to be assigned to a numeric
>>variable "cheesy."
>>
>>
>>J S Huang
>>1-515-557-3987
>>fax 1-515-557-2422
>>
>>>>> A Pal 2/22/2006 4:04:19 PM >>>
>>Hi All,
>>
>> I'm trying to infile a pipe delimited public use medicare formulary
>>file.
>> The record layout has an 11-digit NDC code followed by a one-digit
>> drug tier code. I found that reading it in order using the code
>>below
>> made the 'tier' drug get set to missing and all subsequent variables
>> were shifted over. The last variable is drug name and it can be 40
>> characters long, with spaces, and if there is no drug name, the
>> field is filled with a single space. This datafile has over 10
>>million
>> records and it is replaced every month, so it would be great to have
>> a working program that doesn't resort to the cheesy trick of
>>including
>> the 'cheesy' variable as I've done below and to make the drug name
>> variable print correctly ( obs gets overwritten in 10 and 11 ).
>> Many thanks for help! I've been playing with reading the data
>> in a number of different ways, and this is the best I've been able to
>>come up with.
>>
>> Thanks,
>>
>> Jyan
>>
>> RAW DATA:
>>
>> H0104|00001356|9|00002950501|1|N|N|N|CEFAZOLIN SODIUM
>> H0104|00001356|9|00002721701|1|N|N|N|HEPARIN SODIUM
>> H0104|00001356|9|00013105602|1|N|N|N|
>> H0104|00001356|9|00006494300|1|N|N|N|PNEUMOVAX 23
>>
>> CODE:
>>
>> data formulary ;
>> infile "mydata.txt" dsd delimiter='|' ;
>> input contract_id $ formulary_id $ formulary_version ndc $11. cheesy
>>tier
>> quantity_limit_yn $ prior_auth_yn $ step_ther_yn $ drug_name : $40. ;
>>
>> RESULTS:
>>
>> 8 H0104 00001356 9 00002950501 . 1 N N N
>> 9 H0104 00001356 9 00002721701 . 1 N N N
>> 10 H0104 00001356 9 00013105602 . 1 N N N
>> 11 H0104 00001356 9 00006494300 . 1 N N N
>>
>> Obs drug_name
>>
>> 8 CEFAZOLIN SODIUM
>> 9 HEPARIN SODIUM
>>
>> PNEUMOVAX 23
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>---------------------------------
>>Brings words and photos together (easily) with
>> PhotoMail - it's free and works with Yahoo! Mail.
>>
>>
>>
>>---------------------------------
>> Yahoo! Mail
>> Use Photomail to share photos without annoying attachments.
>
>
>
>---------------------------------
>Brings words and photos together (easily) with
> PhotoMail - it's free and works with Yahoo! Mail.
|