Re: [R] R is creating a new level which is emty after importing a SAS file

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [R] R is creating a new level which is emty after importing a SAS file

Peter Dalgaard-2
It is not obvious that this is an error. If your nominal variable in SAS has a level which is not present in data, then R might just be making a faithful translation. There is a distinction between (a) having a gender variable with two levels of which 0 females and (b) pretending that male is the only possible gender.

Anyways, droplevels() is your friend. (Notice that it easier to remove levels that you do not want than to insert levels that have been unwantedly deleted on input.)

-pd

> On 4 Jul 2018, at 19:16 , Adam Z. Jabir <[hidden email]> wrote:
>
> Hi,
>
> I have imported some sasdata into R using the sas7bdat package. I have some nominal variables with some missing values.
>
> R is creating a new level which is emty �.When I ask for tabulate this new level is presented with 0 as a frequency.
>
> I want to get rid of this level and have my file imported correctly.
>
> Do you have some hint to help solve this problem?
>
>
> Please use this email adress to answer this query.
>
>
> Best,
>
> Adam
>
>
> Envoy� � partir de Outlook<http://aka.ms/weboutlook>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel