How to view/export Data with Labels?

Validate, clean, transform and transfer data.

How to view/export Data with Labels?

Postby Sumit » Fri Jan 29, 2010 4:19 pm

Hi Masters,

Is there any method known by which we can show/view Categories Labels (Text) in exported data?
There are ways to switch between Values/Names view of the category, however I did not find anything for Labels/Text :(

Thanks for any help!

Thanks
Sumit
 
Posts: 2
Joined: Fri May 16, 2008 8:56 am

Re: How to view/export Data with Labels?

Postby klaus » Mon Feb 01, 2010 5:50 am

Hi Sumit,
of course there are ways to show the texts for the categories a respondent selected. I think we have to distinguish different situations where you are "exporting" data. As long as you run a "simple" DMS script you are transferring data from file format A to file format B. What you get in the output will depend on the DSC you are using. I actually don't really see a way to influence the way the DSCs are handling categorical values. Even the CSV-DSC does deliver the category names to the output file and I'm not aware of a way changing this behaviour to exporting the labels.

However you can create your own output file in the "OnNextCase" event of a DMS script. There you can use the function "format" to write the labels or even the full labels (i.e. including text substitutions) into your output. Maybe these lines can give you a short impression about what I'm talking about:
Code: Select all
Event(OnJobStart, "")
   Dim objFso, objFile

   Set objFso = CreateObject("Scripting.FileSystemObject")
   Set objFile=objFso.CreateTextFile("test.txt",True,False)
   
   dmgrGlobal.Add("FILE",objFile)
End Event

Event(OnNextCase, "")
   dmgrGlobal.FILE.WriteLine("gender: " + format(gender,"b") + ", age: " + format(age, "b") + ", museums: " + format(museums, "b"))
End Event

Event(OnJobEnd, "")
   dmgrGlobal.FILE.Close()
End Event

If you want to have the full label written to your output you should use "B" instead of "b". You may want to look into the details about "format" in the DDL, which provides a whole bunch of examples for this function. In my example I created a simple text file with just three variables. But you could create any other type of file you want to. I hope this helps.
Klaus
Klaus Danker
datab GmbH, Frankfurt, Germany
klaus
 
Posts: 105
Joined: Tue Jan 29, 2008 7:02 am
Location: datab GmbH, Frankfurt, Germany

Re: How to view/export Data with Labels?

Postby Sumit » Mon Feb 15, 2010 3:28 pm

Thanks, this is useful!
Sumit
 
Posts: 2
Joined: Fri May 16, 2008 8:56 am


Return to Data Management

Who is online

Users browsing this forum: No registered users and 1 guest

cron