De-pivot excel file [SOLVED]

capson
capson New Altair Community Member
edited November 2024 in Community Q&A
I am trying to de-pivot a excel file like below, the "NA" are null values, I have Field3 and field4 set as integers

I have:
attribute name >> edit list >> attribute name = field3 & atrributes = .*

index attribute = myNewFieldName
checked create nominal index
checked keep missings

I keep getting the error:
Process failed
"attributes have different value types: no conversion performed"
Any help is greatly appreciated
Thanks
id field1 field2 field3 field4
1 stuff aaa      4       3
2 stuff bbb      7       6
3 stuff ccc      NA    1
4 stuff ddd      3       3
5 stuff eee      9      NA
6 stuff fff        6      NA

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • MariusHelf
    MariusHelf New Altair Community Member
    This depends on what you want to achieve... The problem, however, is that after De-Pivot all attributes that match the regular expression on the right side of "attributes = .*" will be located in the same column and thus must have the same value type. In your case .* matches all attributes, i.e. field1-4, that obviously have different value types. You can use either field1-2 or field3-4, which you can specify in the regular expression e.g. as "filed3|field4". Hope this helps!

    Best regards,
    Marius
  • capson
    capson New Altair Community Member
    Hello Marius (Nice mutton cop whiskers!), thanks for the response

    I need,

    id  field1  field2  Cnewfeld    Col5
    1  stuff  aaa    field3          4
    1  stuff  aaa    field4          3
    2  stuff  bbb    field3          7
    2  stuff  bbb    field4          6
    3  stuff  ccc    field3          NA
    3  stuff  ccc    field4          1
    4  stuff  ddd    field3          3
    4  stuff  ddd    field4          3
    5  stuff  eee    field3          9
    5  stuff  eee    field4          NA
    6  stuff  fff      field3          6
    6  stuff  fff      field4          NA
  • MariusHelf
    MariusHelf New Altair Community Member
    What does this table mean?
  • capson
    capson New Altair Community Member
    Thank you  I did not notice that "filed3|field4" the first filed3 was miss spelled, after correcting it all is working well.
  • MariusHelf
    MariusHelf New Altair Community Member
    Ups, sorry :) Glad that it is working now!

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.