6 # Don't edit the line below, it must look exactly like this.
7 # Everything above this line will be replaced #
14 use vars qw/ $opt_help
20 $opt_debug_subroutine /;
22 ## Configure the command line parsing
23 Getopt::Long::config("auto_abbrev");
25 ## Declare the options
26 my $res = GetOptions("help", # Display help message
33 "debug_subroutine:s" );
37 if($opt_help or $opt_h) {
42 Unwrap_data is a perl script that unwraps a data file coded with
43 the CONT data item for split rows. The only restriction is that
44 the subject identifier (ID) must be in column one.
49 [-cont_column=column_number]
50 [-new_name=new_filename]
54 ./unwrap_data -idc=1 -new=new_wrapped.dta old_big.dta
59 The column number of the CONT data itemn.
62 The name of the new data set. If no name is given, the result
63 is printed on standard output.
70 ## Check that we do have a model file
71 if ( scalar(@ARGV) < 1 ) {
72 print "A data file must be specified. Use 'unwrap_data -h' for help.\n";
76 ui
-> category
( 'data' );
78 debug
-> level
( $opt_debug );
79 debug
-> package( $opt_debug_package );
80 debug
-> subroutine
( $opt_debug_subroutine );
82 my $data = data
-> new
( filename
=> $ARGV[0],
84 cont_column
=> $opt_cont_column );
87 if ( defined $opt_new_name ) {
88 open( NEW
, ">$opt_new_name" );
89 my ($data_ref, $prim_ref, $sec_ref ) = $data ->
90 format_data
( wrap
=> 0 );
91 print NEW @
{$data_ref};
94 my ($data_ref, $prim_ref, $sec_ref ) = $data ->
95 format_data
( wrap
=> 0 );