Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: AW: Return a specific bit from integer variable


From   Steinar Fossedal <steinar.fossedal@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: AW: Return a specific bit from integer variable
Date   Sun, 4 Oct 2009 14:12:44 +0200

Thank you for your answer, Martin.

That leaves me with the problem is finding a suitable format in my
string conversion. I can't seem to find a binary format in Stata, I'm
using Stata 10.

Cheers,
-Steinar

2009/10/4 Martin Weiss <martin.weiss1@gmx.de>:
>
> <>
>
>
> Have you had a look at -split-?
> If the thing is not a -string- yet, you can turn it into one via -string()-, on the fly...
>
> HTH
> Martin
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Steinar Fossedal
> Gesendet: Sonntag, 4. Oktober 2009 08:46
> An: statalist@hsphsun2.harvard.edu
> Betreff: st: Return a specific bit from integer variable
>
> Hello again, listers!
>
> I have imported an 8-bit integer variable where each bit represents a
> flag telling me if some property of the observation is true or false.
>
> E.g. the number 8 in binary format is 00001000, while 10 would be
> 00001010. Bit nr. 4 from the left tells me if a car is delivered or
> not, while the second to the right tells me if it's paid or not. So 8
> = car is delivered but not paid, 2 = paid but not delivered, 10 = paid
> and delivered, etc.
>
> I need to split this information into 8 dummyvariables so they can be
> used to segment my data.
>
> Does there exist a fairly smooth way to do this in Stata?
>
> Cheers,
> -Steinar
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index